- Home /
Broomstick Flying with Rigidbody?
I have been searching all over for a decent tutorial or script to modify and haven't had any luck. I am looking to achieve a semi-realistic rigidbody controller that can fly left/right, forward, and hover. I am still a beginner, some basic knowledge of Actionscript (like javascript) but the advanced 3d equations puzzle me. Please don't suggest a Google search, I have been trying for an hour.
Thanks :)
Should the guy always be hovering or you need to hit a button to hover?
you should have to hit a button for the character to fly but it would be nice for him to maintain distance from the ground so he doesn't touch it
Answer by MikezNesh · Jul 13, 2010 at 11:07 PM
For hovering just add a bobbing up and down on a broom animation and set the y axis to whatever value you want. Depending on how far up you want him. Or you could add relative force if you want the guy to be able to push off other objects if there are hills or stuff.
For moving controls follow a tutorial like this one:
[http://www.youtube.com/watch?v=gUZOZP-sgng&feature=related][1]
or
[http://unity3d.com/support/resources/tutorials/car-tutorial][2]
EDIT:
to move with rigidbody you can do on Input.GetKey() blah and set speed to an axis.
EDIT #2:
to set up speed for rigidbody use this code:
if (Input.GetButtonDown ("blah")) {
rigidbody.velocity.y = 10;
}
note: the .y changes depending on what axis you want to move on.
i need to use a rigidbody for the controller since then i would get somewhat more realistic flying physics and the character controller collider is a real pain with my model.
How exactly would I set speed 0.o I have some code but of course my pure uselessness kept me from completing or fixing it :( sorry for being such a noob
It's ok. Will edit post to answer in 20 $$anonymous$$utes. (Sorta busy AT$$anonymous$$)
Your answer
Follow this Question
Related Questions
Rigidbodies flying up in the air on collision 4 Answers
Player bouncing off issue 1 Answer
Trees are flying when rigidbody is activated 1 Answer
Rocket-styled angular drag 0 Answers
Fly Mode 2D + Rigid Body vs CharacterController problems 0 Answers