New answers tagged

2

When you are dealing with AddForce and AddTorque, you are simulating physics. You are utilizing the RigidBody component of your physics engine. Do you require a physics engine for your game? Or do you want to fake the physics yourself? You cannot apply forces to a transform. You also don't need to have a RigidBody component on your gameobject in order ...


1

Adding force means you are simulating some degree of pysical movement. Do not play with vector(force) if you do not need to simulate physical property in your game.


0

You can solve it easy by making additional rectangle above the rectangle attached with it, and respond differently for each rectangle, by this way you can control the collision


0

You can try something like this. float step = speed * Time.deltaTime; Vector3 newDir = Vector3.RotateTowards(transform.forward, directionOfTravel, step, 0.0F); transform.rotation = Quaternion.LookRotation(newDir);


1

When in doubt: Fake it. Instead of calculating the wheels from where the cart is, calculate the wheel direction from where the wheel was. Something like this: //Constants, per wheel. I'm assuming Y is up/down var wheelOffset = Vector3( -40, 0, -10 ); //Variables kept over multiple frames, per wheel var wheelAngle = 0; var lastWheelPosition = 0; //Per ...


0

Rather than fiddling with angles, you can use a cross-product to know in which direction you should rotate. Don't be scared by the theory dump : it's actually pretty simple to use! Let C be current and F be future. They are both 3-dimensional vectors, with z = 0. Then the cross-product P = C×F has the following properties: Px = 0 and Py = 0; Pz = CxFy - ...


0

The idea of measuring the distance between quaternions is indeed a useful similarity measure. In essence, what you can measure the dot product between two quaternions qA and qB just as you compute the dot product of two vectors (see this). Moreover, since you have unit quaternions (they do represent rotations!), the dot product should be between [-1,1]. ...



Top 50 recent answers are included