|
I'm using This to make an item move, if (Input.GetKey ("w")) { rigidbody.AddForce(Vector3.forward * 45); } And i was 1. Wondering if there is a way to make the an item JUST move forward, instead of rotating it, which is what this causes the item to do. For example, i used a cube to test it out, and when it starts to move, instead of it "gliding" across the ground its edge stops it and it has to "flip" over.
3.How would i get the object to rotate based on direction while the camera is fixed? Meaning when i go forward its forward, left it turns and goes left, etc. etc. http://4.in the (Vector3.forward *10); what is the substitution for "forward" for other directions? It's the only one in the script reference and -forward and backward don't work... Thanks!
(comments are locked)
|
|
Ok, for the movement: I would set the velocity directly instead of applying a force. So the code would be That should solve your fliping over problem. For the camera, instead of attaching it directly to your game object, you could add a script to the camera that tells it to follow the player. Could be something as simple as Vector3 has constants for forward, right and up. If you want the negative (like a "backward") you would write "-Vector3.forward" or "Vector3.forward * -1" Remember that Vector3.forward stays the same, no matter where your object is facing to. If you want the forward vector relative to the object (the objects z axis), you can use transform.forward instead. Hope that helped.
(comments are locked)
|
