[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Search] [Home]
Board
Settings Home
/3/ - 3DCG



Thread archived.
You cannot reply anymore.




File: 2018-12-23 (1).png (625 KB, 1920x1080)
625 KB
625 KB PNG
Hey i'm new to scripting in unity and I'm stuck at using unity's look at function and keeping an objects parent y rotation.

i have 2 cylinders and my script works fine on them on individually, but together it messes up. i understand that why it doesnt keep its parents y rotation but i dont know how to fix it.

is there some way i can have the y rotation in a variable and use it for the y of the x motor?

my script:

https://pastebin.com/cdU3FHDL
>>
>>657628
Have a look at 'Quaternion.LookRotation' in the scripting API. Working with rotations is much easier that way.
To limit the turrets time to acquire targets you also wanna make good use 'Quaternion.Lerp'.

For a turret you want one joint for elevation (as in gun barrel) parented to one joint for traversal (turret baseplate).

Then the pseudocode to make the turret aim at a target would be something like

turretRotation = Quaternion.LookRotation(targetVector, tankUpDirection);
gunRotation = Quaternion.LookRotation(targetVector, turretsRightDirection);
>>
Can you elaborate on what to are trying to do exactly?
>>
>>657696
>What to
What you*



Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.