- Home /
Pounce/ Launch player
Is there a way to do a pounce without a rigidbody controller?
Pounce: If you've ever played "the hidden" you can launch yourself in the direction you are facing. So it would probably be something like
forward = Camera.main.transform.forward;
and then launching the player. How would I do this?
Answer by Soos621 · Apr 18, 2015 at 11:41 PM
you can addforce in the direction the camera is facing by doing
Ray jumpRay = new Ray(Camera.main.transform.position, Camera.main.transform.forward 1); characterRigidBody.AddForce(jumpRay.direction jumpForce);
~Soos
no sorry the addforce is a function of the rigidbody you can simulate the jump by using lerping the position i guess but rigidbody is probably the way to go is this a 2d game?
Its a 3d game. - So I would have to use a rigidbody controller? - Because I don't have that much experience with rigidbody...
http://docs.unity3d.com/ScriptReference/Rigidbody.html
http://docs.unity3d.com/$$anonymous$$anual/class-Rigidbody.html
http://unity3d.com/learn/tutorials/modules/beginner/physics/rigidbody
those should help you understand what the rigidbody does in unity. i would really suggest looking into it before you go simulating the movement through position alone.
if you really want to avoid the rigidbody then you can do this,
Raycast camRay = new Ray (Camera.main.transform.position, camera.main.transform.forward); RaycastHit camHit;
if(physics.raycast(camRay, out camHit){ transform.position = Vector3.Lerp(transform.position, camHit.point, 1f); }
Your answer
![](https://koobas.hobune.stream/wayback/20220613193452im_/https://answers.unity.com/themes/thub/images/avi.jpg)