Category Archives: Unity3D

Don’t access Unity projects via network shares

I must admit that I feel stupid for not having realized this earlier but I was updating / dual using Unity 3.5 and 4.0 as well when this happened, so I was a little unsure what was causing it, but here goes: If you access your Unity project on a network share (like: \\server\project\game) then [...]

Offroad Speeder v02

I updated the version of the Speeder with the CarSmoothFollow Script from the Unity Wiki. I also added detachable spoilers via the Hinge Joints (setting the Limits very narrow so that they don’t move by themselves). The Fixed Joints seemed a good idea at first but they wouldn’t keep still. So to prevent the spoilers [...]

Basic Car Setup

My current findings for setting up a car rig have been the following: As we usually deal with several wheels I use arrays to store everything. This lets me add more wheels without breaking into a sweat or having to go copy-paste all over the place. The base vehicle Axis contains four wheel axis objects [...]

Offroad Speeder

I’ve experimented with an offroad vehicle, based on the experiences gained with the truck. The basic setup wasn’t too difficult and even jumping and speeding over the rough terrain was pretty nice, but trying to point the car in the right direction or even getting it through the poles grew into quite a challenge because [...]

Improved Trucking Physics

Had another go at the WheelCollider, as I wasn’t convinced that completely custom built vehicle physics would save that much time, and I have made a couple of improvements. Most of all the Suspension is now correct, as I was doing it wrong most of the time: The best way to start is to set [...]

Calculate angle from current heading to target object

If you want to have an object turn automatically towards a target then you have to find out in which direction to turn. The usual angle function just returns the smallest angle between the current heading and the heading towards the target but not which way around. Vector3 lTarget = transform.InverseTransformPoint(target.position); targetDistance = lTarget.magnitude; targetAngle [...]

Get Vector3 from Quaternion / Rotate Vector3

To get the vector from a quaternion rotation you simply multiply the quaternion by the forward vector. Debug.DrawRay(transform.position, transform.rotation * Vector3.forward, Color.red); This also effectively rotates the forward-vector with the rotation of the transform, positioning it relative to the rotation of the actual object.