Scripts / [Help Wanted] Gameguru Drive Vehicle Script And vehicle ?

Author
Message
GubbyBlips
2
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 8th Aug 2021 06:51 Edited at: 9th Aug 2021 01:19
No chance of getting Rotation of an entity to conform to physical objects
via script! The 3 different axis in GG scripts behave 3 different ways:
X: always local
Y: gimbal mix
Z: always world

GG is better off being left as a 2D game tester. My ulcers are making me sick trying to get simple rotation script, test, change script, test, change script, test, change script, test try again for hours.

Free Script to test yourself:
xangle = 0
yangle = 0
zangle = 0

function testrotate_z_init(e)
end

function testrotate_z_main(e)

if g_Scancode == 23 then -- "i" less y
yangle = yangle - 1 end
if g_Scancode == 24 then -- "o" more y
yangle = yangle + 1 end
if g_Scancode == 37 then -- "k" less x
xangle = xangle - 1 end
if g_Scancode == 38 then -- "l" more x
xangle = xangle + 1 end
if g_Scancode == 51 then -- "<" less z
zangle = zangle - 1 end
if g_Scancode == 52 then -- ">" more z
zangle = zangle + 1 end

CollisionOff(e)
SetRotation(e, xangle,yangle,zangle)
ResetRotation(e, xangle,yangle,zangle)

Text(11,11,1, "yangle "..yangle )
Text(11,15,1, "xangle "..xangle )
Text(11,19,1, "zangle "..zangle )

end
PM
Chanu 2266
User Offline
Joined: 23rd May 2021
Location:
Posted: 8th Aug 2021 11:30 Edited at: 10th Aug 2021 12:11
Thank you....
Dhanushka
PM
AmenMoses
GameGuru Master
5
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Aug 2021 13:28
They are Euler angles, it's not GG's fault if you don't understand Euler angles!

https://www.euclideanspace.com/maths/geometry/rotations/euler/
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
2
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 9th Aug 2021 02:28
Interesting.
I updated the script, but not sure if anyone wants to use it for expanded rotation testing,
I'm using separate RotateX(e,v), RotateY(e,v), RotateZ(e,v), instead of SetRotation(e,x,y,z)
you can start, stop, and reset these individually.
so regardless of that, two things that I noticed (so far!) as anomalies in GG rotation:
1-
If you put any object on the map and rotate it 'Y' 180 degrees "r,r,r,r" then
put the same object on the map in original 'Y' orientation, (nothing else) then;
when you rotate each of them via same script @ 'Y' axle only-- they spin opposite directions!
That's a real I can't see Eulers causing that one... try it out.
Just tried this by resetting all angles to 0 in script, rotating 'X' -30 then spinning 'Y' and it
did NOT behave the same way. So now 'Y' is acting as local rotation, but not if you place the
object down on the map in any angle other than Zero. So are we getting somewhere?
2-
I put an object on the map and then rotated it about ~30 on 'X' axis by widget
then via script rotated this on 'Y' axis, but it rotated as clear as can be on X axis.
Also reset angles via script and did the same test, and it wasn't the same results....?
Really weird behavior. Not sure how to tackle all this going on?
PM
AmenMoses
GameGuru Master
5
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Aug 2021 18:06 Edited at: 9th Aug 2021 18:08
Strictly speaking there is no 180 degrees in Y with Euler angles, Y goes 0 .. 90 .. 0 .. -90 .. 0, So North and South are 0 East is +90 and West is -90 ... but GG accepts 0-360 angles for Y and under the covers limits to the correct range, which works fine if X & Z are 0, but when they aren't all sorts of strange looking behaviour will occur.

Use quaternions and eliminate all the Euler grief!

(btw, X & Z are -180 .. 0 180 )
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
15
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Aug 2021 16:24
this shows how to use amen's libs to rotate an object locally - it's not as simple as RotateX etc but it works - maybe amen can show a better method or how to get it into functions
to use assign to the object you want to rotate and when you walk near it press SPACE to lock the player in place then you can use WASDQE to rotate the object around
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
GubbyBlips
2
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 11th Aug 2021 19:44
Brilliant! That seems to be working. Credit where credit is due for the heavy lifter AM,
and auspicious smallg.
I give credit for myself as the turdy failure because when I tried the quaternions tools
maybe a year ago, it think I got 2 axis working but not a third-- that dern 'Y' still wobbled
all over the place ! wrote it off as a persistent GG bug without asking for further tips.
PM
GubbyBlips
2
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 11th Aug 2021 19:51
Maybe the task is not quite finished (on my workbench) because now I have to see
if I can get GetEntityAngle and etc to be compatible to what references there are
from existing objects (remember when placed down on the map and then calling the
angles), I got odd results- depending on already set angles so... @ testing forward.
PM
smallg
Community Leader
15
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Aug 2021 23:19
Quote: "Maybe the task is not quite finished (on my workbench) because now I have to see
if I can get GetEntityAngle and etc to be compatible to what references there are
from existing objects (remember when placed down on the map and then calling the
angles), I got odd results- depending on already set angles so... @ testing forward."

should be ok, objects facing north/up by default are the norm for GG so this will be the most logical to rotate but it just adds some rotation to the current rotation so it shouldn't really matter what angle they are in.. you can test it by rotating the objects in the editor first and they should still rotate locally as expected
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
5
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 12th Aug 2021 12:27
The only way of generating *local* rotations properly is to use quaternions, that is why they were invented in the first place!

GG could really do with a separate set of rotation functions that take *local* arguments and do the quaternion math under the covers, I would use the terms Yaw, Pitch and Roll for those to differentiate them from the global angle commands.

For example PitchObject( ang ) where a value of 10 would cause the object to pitch up 10 degrees and -10 would pitch down 10 degrees.
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2021-11-27 21:01:43
Your offset time is: 2021-11-27 21:01:43