BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

rotating an object via a key command

3 posters

Go down

rotating an object via a key command Empty rotating an object via a key command

Post by mrknowitall Thu Dec 22, 2011 12:51 am

I seem to be struggling with a really hard one here.

im wanting to "tilt" an object at a specific time. thats not the problem, the problem is how to code it so that i can make it tilt via a key command.

This is my explanation of the command written some years ago in the object guide available here: http://bve.altervista.org/guide.html (the download link is at the right of the bench picture).

Rotate,Ax,Ay,Az,Theta Rotate the geometric figure in the space
Parameters:
Ax Rotation around the X axis horizontal (0 or 1)
Ay Rotation around the Y axis vertical (0 or 1)
Az Rotation around the Z axis longitudinal (0 or 1)
Theta Rotation angle in degrees (from -359 to 359): positive values give a counterclockwise rotation and negative values give a clockwise rotation (Viewing along axis in positive direction).

Ax, Ay and Az can take the value of 0 or 1 in this way:
1, 0, 0, - the rotation is around the axis X (horizontal).
0, 1, 0, - the rotation is around the axis Y (vertical)
0, 0, 1, - the rotation is around the axis Z (longitudinal)
0, 0, 0, - this is a special case, same as 1, 0, 0, (i.e. rotate around X axis only).

It’s possible to rotate simultaneously the object on more than one axle using more parameters A.. = 1, but the result is difficult to control: to have better control it’s better to use more consecutive Rotate instructions, each one having only one A.. = 1 parameter set.

This instruction is indispensable to orientate solids created with the Cube or Cylinder method, that otherwise are always set vertical. It works equally well (but has little sense) for figures defined using AddVertex / AddFace methods

The Rotate instruction for CSV format has no official corresponding in B3D format.

I realize just now that there is an error: it's written counterclockwise instead of clockwise and vice versa...

However this is the way BVE seams to work.

Rotate,0,0,0,0 = don't rotate (same as rotate,,,,)


i founf this on michelles forum. but i dont understand it ? he seems to talk about things well over my own head. so any suggestions?

i have tried the following coding

Code:
[Object]
Position = 0, 0, 0
States = APT_Driving_Trailer.csv
statefunction = if[ pluginstate[20] | RotateYFunction = -[0.1]]



[Object]
Position = 0, 0, 0
States = APT_Driving_Trailer.csv
statefunction = pluginstate[21]
RotateYFunction = [0.2]
mrknowitall
mrknowitall

Posts : 824
Join date : 2011-07-09
Age : 31
Location : W. Yorkshire

Back to top Go down

rotating an object via a key command Empty Re: rotating an object via a key command

Post by Guest Thu Dec 22, 2011 1:03 am

.


Last edited by lonelyinardwick on Wed May 13, 2020 5:21 am; edited 1 time in total

Guest
Guest


Back to top Go down

rotating an object via a key command Empty Re: rotating an object via a key command

Post by Emmanuel Vallois Sun Dec 25, 2011 2:19 am

I suggest the following:

Code:
[Object]
Position = 0, 0, 0
States = APT_Driving_Trailer.csv
RotateYFunction = if[pluginstate[20], -0.1, if[pluginstate[21], 0.2, 0]]
That should work if pluginstate[20] is the variable commanding tilting on the left when nonzero and pluginstate[21] for tilting on the right.

Emmanuel Vallois

Posts : 4
Join date : 2011-08-23
Age : 39
Location : Nice, France

Back to top Go down

rotating an object via a key command Empty Re: rotating an object via a key command

Post by mrknowitall Sun Dec 25, 2011 2:23 am

ill give that a go! I never knew you was good at animated coding!
mrknowitall
mrknowitall

Posts : 824
Join date : 2011-07-09
Age : 31
Location : W. Yorkshire

Back to top Go down

rotating an object via a key command Empty Re: rotating an object via a key command

Post by joeyfjj Sun Dec 25, 2011 7:00 pm

I suggest dampening so the cars don't "snap" back upright, instead tilting slowly back. Play with the figures and choose the best.

joeyfjj

Posts : 266
Join date : 2011-07-30
Location : Singapore

http://joeyfoo.com

Back to top Go down

rotating an object via a key command Empty Re: rotating an object via a key command

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum