I cant find a script for my helicopter to simply pass by and hover over me with the rotors moving. Can someone help me?
use the first couple references at this site and they give u the scripts on how to do that :
hint: use transform.Translate(0, 1, 0); and adjust the numbers >>> in the brackets are your x,y,z axis to do the helicopter thing … x being left right,etc…
http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Components.html
have fun ![]()
finally, thank you ima check this out ill tell u if it worked
ok, that isnt working cause it moves off the chopper ![]()
its a start though… if u attached it to the whole helicopter, then it would move the whole helicopter to whatever xyz axis you wanted… then maybe use the joint code idea on the rotors and use a different transform.Translate on the rotors
I put it on the rotors, it started to spin, and it moved out of place, and stated circling the helicopter instead of on it.
The code you sent makes it move on the y axis, can you make it spin in place?
pm sent to you explaining how
all it does is rotate it not spin it
you need to adjust the numbers inside the brackets(0,5,0) to whatever numbers to get it to do what you want it to do …or you might want to use another method : rotatevec
Absolutely positively go through at least one example project (3rd person platformer, first person shooter, whatever) from http://unity3d.com/support/
Without doing that you’ll have a long learning process to think the way Unity wants you to think.
After that, use the Script Reference constantly, as it is your Bible while working in Unity (you can also get to an offline copy through Unity’s Help menu).
To make something rotate, rotate its transform
ConstantRotator.js
var rotationSpeed : Vector3; // degrees per second
function Update() {
transform.Rotate( rotationSpeed * Time.deltaTime );
}
And to move something, move it
HoverOverTarget.js
var verticalDistance : float; // distance above player to hover
var maxMovementSpeed : float; // units per second
var target : Transform; // transform to hover over
function Update() {
var movement = target.position - transform.position;
movement.y -= verticalDistance;
// Move either at movement speed or directly to desired position, whichever's smaller. Prevents jittering hopefully.
transform.position += Vector3.Min( movement * Time.deltaTime, movement.normalized * maxMovementSpeed * Time.deltaTime );
}
Edit: Rotate takes not the arguments I had there before. D’oh.
My rotors didnt have a pivit point, was a bad model, but I made a cube and made the rotor a child object and it worked!!!
My rotors didnt have a pivit point, was a bad model, but I made a cube and made the rotor a child object and it worked!!!