## This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

• 0

# hellp to get curent z axis

## Question

hi, may somebody know how to get z axis of "transform.Rotate(0, 0, 10);"

like varcur zAxis : float;

curzAxis = transform.Rotate(0, 0, 10);

Edited by arwe2793

## Recommended Posts

• 0

I dont understand what you're asking.

##### Share on other sites

• 0

cool selfie arwe

Yeah what do you exactly want?

##### Share on other sites
• 0

i want to get my z ahis and divide one number of that.

like this

curspeed / zAxis;

coz you see thre are 3 axis, y,x and z. and i need just z value. my player is rotating by z axis, and i need divide speed from degrees of that z axis, but cant realy find how.

transform.eulerAngles.z found this line, but i get eror something like Nan, infinity... or something

speed = Xspeed / transform.eulerAngles.z;

Edited by arwe2793

##### Share on other sites
• 0

Get the Z axis...

Please login or register to see this code.

##### Share on other sites
• 0
Please login or register to see this quote.
Rigidbody2D.AddForce(force) assign attempt for 'blue plane v2' is not valid. Input force is { NaN, Infinity }.
biplane controller:Update() (at Assets/biplane controller.js:44)

:/

Please login or register to see this code.
alovedLiftLevel = curSpeed / 2;
AngleCof = transform.position.z / 2;
CalculatedLiftForce = Mathf.Lerp(CalculatedLiftForce,alovedLiftLevel,Time.deltaTime * (curSpeed * LiftMultiplier));
rigidbody2D.AddForce(Vector2.up * (CalculatedLiftForce / AngleCof));

rigidbody2D.AddForce(Vector2.up * (CalculatedLiftForce / AngleCof));   is 44 line

dont know is my logic is good. i tried make a plane, and as fast plane flee, the hihter wings lift is, wings lift is addforce.

1.calculate max aloved lift acording speed divided by 2

2. calculate angle of z axis

3. calculate final lift force

4. add force to a rigitbody, and calculate it with degrees

z axis need by lower lift when flying in certain degrees

Edited by arwe2793

##### Share on other sites
• 0

that is the z position, if you want rotation use transform.rotation.z or transform.eulerAngles.z

and if the object is local, just use localrotation or localEulerAngles.

##### Share on other sites
• 0

Never set rotation by single axis, you might end up in gimbal lock.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.