hi
I want to accomplish the following:
- place cube center screen
- lock all movement EXCEPT rotating - spinning on Y axis
- enable controller to let me spin the cube using physics
?
I dont know how I might lock every motion except y axis rotation…can someone throw a few hints?
cheers!
Tj
ok
I think I may have it partially figured out…
configurable joint?
lock all movement except Y-angular?
?
Tj
I think i have the joint configured properly…
but now I think the drag code Im using is not properly targeting the right force to make the object spin.
How does one apply (iphone) input code that will only affect rotational Y value of a locked cube - so that it can spin?
Tj
It’s easier to do this:
var rigidMan : Rigidbody;
function Start()
{
rigidMan = rigidbody;
}
function Update()
{
rigidMan.angularMomentum.x = 0;
rigidMan.angularMomentum.z = 0;
rigidMan.velocity = Vector3.zero;
}
This is assuming you wanted to only rotate around the y axis. You’ll need to have a rigidbody attached with gravity turned off, freeze rotation turned off, and iskinematic turned off.
ok
first of all -thank you for replying!
I tried this ( Im using iPhone kit ) - and it wouldnt accept the angularMomentum…
but it was ok with angular velocity??
var rigidMan : Rigidbody;
function Start()
{
rigidMan = rigidbody;
}
function Update()
{
rigidMan.angularVelocity.x = 0;
rigidMan.angularVelocity.z = 0;
rigidMan.velocity = Vector3.zero;
}
or did I need to set the type somewhere because of strict typing?
Tj
I guess what Im trying to do - is a like a top - but locked on its axis so its stays center screen.
I want the force input to come from screen input - and I think thats where Im not getting things right.
The input script i have - I believe just affects xy ( up down / left right ) - and not rotational force?
?
Tj