Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Set rotation snap to grid question

Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
01-13-2009 09:37
Hey all,

I have a HUD that rezzes an object within on command. When it drops however, the rotations can be a little off.

For example instead of getting say <0,0,90> I am getting <359.6,0.2,89.9>

Is there a line of code to snap to nearest vector? so if it lands at 89 it will snap to 90?

Thanks in advance :)
_____________________
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
01-13-2009 10:51
What about...

float GRID_INC = 5.0;
vec.z = llRound(vec.z / GRID_INC) * GRID_INC;

...?

/esc
_____________________
http://slurl.com/secondlife/Together
Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
01-13-2009 11:25
Thats what i was looking for :) thx!!
_____________________
Winter Seale
Registered User
Join date: 27 Dec 2006
Posts: 30
01-13-2009 13:22
Turokhan, I can't speak for anyone else but personally I'd really appreciate it if you would shrink your forum sig a bit. The largest a signature can be without stretching the forum page is about 500 pixels. Yours is 1286. =p

Actually, I feel strongly enough that I've gone and made a shrunk down one for you. =D

http://winterseale.com/siggykl8_small.jpg
_____________________
~~ Winter Seale ~~ http://winterseale.com/ ~~
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
01-13-2009 16:05
Ahhhhhhhhhhhhhhhhhhhhhhhh Sig Ad Spam

Edit: Thanks
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client
Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
01-13-2009 16:16
i do apologise people, i didnt even realize..it was just html links on mine :/

Sorry again