Jump to content

Recommended Posts

Hi,

I'm trying to rotate an object with: https://community.bistudio.com/wiki/ctrlSetModelDirAndUp

Which is a command for GUI that is the same as: https://community.bistudio.com/wiki/setVectorDirAndUp

I have the rotation working as I wish this is the code I'm using, the code bellow rotate's the object based on the direction the player is facing:
While {true} do {

    _vD = vectorDir player;
    _c ctrlSetModelDirAndUp [
        [(_vD select 0),(_vD select 1),0],
        [0,0,1]
    ];
    
    sleep 0.01;

};

However I'd also like the object to tilt towards the player at all times. Does anyone know how to achive this?

 

Ive done some experimentation and found:

The object is tilted correctly when the player is facing north:   

[(_vD select 0),(_vD select 1),0.20]
[0,0,1]
The object is tilted correctly when the player is facing south:   
[(_vD select 0),(_vD select 1),-0.20]
[0,0,1]

I would like to know how to get it to tilt correctly towards the player no matter which way the player is facing.

Hopefully I've explained that well enough.

Thanks.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×