rotating an object via a key command

View previous topic View next topic Go down

rotating an object via a key command

Post by mrknowitall on 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]
avatar
mrknowitall

Posts : 711
Join date : 2011-07-09
Age : 24

http://www.bve-terminus.org/pioneertrains/

Back to top Go down

Re: rotating an object via a key command

Post by lonelyinardwick on Thu Dec 22, 2011 1:03 am

I'm not fully convinced if Luigi's post relates to animation, as far as I'm concerned, he explained the Rotate command in a MeshBuilder. Of course, this was posted back in 2008 when openBVE was just getting started, thus my point.

lonelyinardwick

Posts : 375
Join date : 2011-07-24

https://about.me/lonelyinardwick

Back to top Go down

Re: rotating an object via a key command

Post by Emmanuel Vallois on 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 : 32
Location : Nice, France

Back to top Go down

Re: rotating an object via a key command

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

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

Posts : 711
Join date : 2011-07-09
Age : 24

http://www.bve-terminus.org/pioneertrains/

Back to top Go down

Re: rotating an object via a key command

Post by joeyfjj on 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 : 262
Join date : 2011-07-30
Location : Singapore

http://openbve.joeyfoo.com

Back to top Go down

Re: rotating an object via a key command

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


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