#Rotate About Axis - GameObject Rotation Independent

1 messages · Page 1 of 1 (latest)

crystal seal
#

Hi guys 🙂
Sometimes I have such brain blockade, I can't get around and I have the feeling this problem is really easy to fix ...

I googled for it, but actually couldn't find anything to be honest ...

Anyway. What my problem is:

I have a direction vector (wind)
This vector is being used to deform my trees, using "Rotate About Axis".
When having the gameobject with a rotation of 0,0,0, it works. With rotation applied, obviously it does not work, since is using object space positions.

So my simple question is ... how to bend the tree to the right direction, even with rotation applied?
I already tried several stuff with world positions, adding pivots forth and back ... and stuff like this. My only guess is, I need to get access to the rotation of the game object to counter the direction ...

Would really appreciate some help 🙂

fierce narwhal
#

You can get the vert position in world space btw and you should be able to convert it back to object after

crystal seal
#

This was also my first guess, but ... how?
This is fixing my rotation problem, but is messing up my positions :/

I guess I have to add/subtract something to get it correct afterwards, right?

fierce narwhal
#

When in world space the rotation wont act correctly... What you can instead do is transform the wind direction from world to object space
that should make it work regardless of rotation 🤔

#

I forgot that when the positions are in world space it will rotate around 0,0,0 which may be super far away

crystal seal
#

I knew it was something super easy ... and actually I forgot that the transform node also come with a direction transform. Well, well 😄

Thanks a lot!

fierce narwhal
crystal seal
#

Needs definitely some adjustments, but they do their swaaaay 😄
Thanks again - you've made my day. Can't tell anyone how long it took me to get this to work ^^

fierce narwhal
#

If the origin is 0,0,0 then you can say use y to slowly increase the intensity of movement

#

another technique is to use vertex colours to mask such effects to leaves only

fierce narwhal
crystal seal
#

Yep, from here on I think I know how to progress.
Currently a single channel texture is controlling the gusts/strength, but I think I will replace this with a normal map like texture to get less uniform movements by also modifying the axis

fierce narwhal
#

Hmm you could sample noise using world x z to have some difference. Shader graph should have noise sample functions.

crystal seal
#

Jep, but I've noticed that there noises, at least the one I have used, are very fragile when using these with world position uvs.

I do not know why, but when using these, the UVs are influenced while moving the camera.
Used this for the leaves and they jittered like hell when moving the camera. Could be also something else.

fierce narwhal
#

that would imply that there is some issue with precision when world position is calculated which shouldnt be the case