Forum Discussion
Futuristichub
11 years agoHonored Guest
Harrier Jet Scripting Problem
Hey everyone! I've almost got my project controls complete! I need one more thing. I can't seem to get my script to allow my vehicle in the air to thrust forward and then backwards in Zero Gravity. Think Spaceship type... So far im able to get it to do everything except the trust. A roll would be nice but I can't do Forward Thrust and I tried Vector.Forward, and that only goes along an axis that i'm not facing. I would like no matter what where ever the Vehicle is facing, if I press a key, it will go forward.
Any help is much appreciated! Wait til you see the demo I have in store for you guys!
Thank you!
Any help is much appreciated! Wait til you see the demo I have in store for you guys!
Thank you!
5 Replies
Replies have been turned off for this discussion
- AnonymousTry transform.forward instead of Vector3.forward. Vector3.forward is a global direction, transform.forward is the localized direction.
- FuturistichubHonored Guest
"ronczarnik" wrote:
Try transform.forward instead of Vector3.forward. Vector3.forward is a global direction, transform.forward is the localized direction.
Thanks! I actually did try this and since my vehicle is in "zero G" it doesn't work well and act like Zero G. I can turn and pitch just fine but thrust forward and back in Zero G is a no go. :/ - FuturistichubHonored Guest
"FuturisticHub" wrote:
"ronczarnik" wrote:
Try transform.forward instead of Vector3.forward. Vector3.forward is a global direction, transform.forward is the localized direction.
Thanks! I actually did try this and since my vehicle is in "zero G" it doesn't work well and act like Zero G. I can turn and pitch just fine but thrust forward and back in Zero G is a no go. :/
This code keeps me on the Z axis no matter what. The Vehicle won't go forward :/
if(Input.GetKey(KeyCode.W)) {
transform.forward += transform.forward * Time.deltaTime * movementSpeed;
}
else if(Input.GetKey(KeyCode.S)) {
transform.forward -= transform.forward * Time.deltaTime * movementSpeed; - cyberealityGrand ChampionYou're adding a direction vector to itself, which doesn't make sense.
You need to do something like this:transform.position += transform.forward * Time.deltaTime * movementSpeed;
- FuturistichubHonored Guest
"cybereality" wrote:
You're adding a direction vector to itself, which doesn't make sense.
You need to do something like this:transform.position += transform.forward * Time.deltaTime * movementSpeed;
Thank you! It does work but its a sudden forward. I tried that before and the same thing. I'm trying to get a gradutal thrust and backwards thrust with "W" and "S" key. I almost got it actually. I have Pitch, Yaw, Roll, and up and down. Now all I need is a thrust. So close!!
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 5 months ago
- 10 months ago
- 9 months ago
- 8 months ago