Rotating Cylinders
2 posters
Page 1 of 1
Rotating Cylinders
Guys,
Just a quick question that I'm sure someone will know the answer to. I am currently building an object that has handrails, and I am experiencing great difficulty in rotating a particular cylinder I am using for one of these handrails. I have 3 cylinders, all at the same x value, +2.6. The first one is horizontal, about 25m long, and then one that is vertical to be the end support for the handrail. However I can't get the cylinder to rotate in the correct direction, I need it to be 45 degrees but parallel to the x axis if this makes sense. Like so:
__________
/
/
/
/
/
/
|
|
|
|
Any ideas?
Thanks
Tom
Just a quick question that I'm sure someone will know the answer to. I am currently building an object that has handrails, and I am experiencing great difficulty in rotating a particular cylinder I am using for one of these handrails. I have 3 cylinders, all at the same x value, +2.6. The first one is horizontal, about 25m long, and then one that is vertical to be the end support for the handrail. However I can't get the cylinder to rotate in the correct direction, I need it to be 45 degrees but parallel to the x axis if this makes sense. Like so:
__________
/
/
/
/
/
/
|
|
|
|
Any ideas?
Thanks
Tom
Tstageman- Posts : 154
Join date : 2011-10-21
Re: Rotating Cylinders
Rotating Cylinders is easy.
1. Always remember to use 1 rotate rotate command per axis
2. Use rotate BEFORE translate, because the other way around creates the cylinders shifted in an unintended way.
Like This:
Hope this helps, you can replace the example values by any of your own and use a texture instead of SetColor, of course.
Also, if you don't need the basis of the cylinder, you can omit it and save some performance by not rendering this complex face. In such case, use
Cylinder, 16, -0.5,-0.5,1; (Example dimensions)
1. Always remember to use 1 rotate rotate command per axis
2. Use rotate BEFORE translate, because the other way around creates the cylinders shifted in an unintended way.
Like This:
- Code:
CreateMeshBuilder,
Cylinder, 16, 0.5,0.5,1; (Example dimensions)
Rotate, 1,0,0,45; (Rotates 45 degrees along X-axis)
Rotate, 0,0,1,45; (Rotates 45 degrees along Z-axis, in your case, only a simple rotation along one axis will be needed, this is just an example)
Translate, 0,0,3; (Shifts the ALREADY ROTATED cylinder by 3 meters along Z-axis)
SetColor, 0,0,255; (Assigns a color, this example would be blue)
Hope this helps, you can replace the example values by any of your own and use a texture instead of SetColor, of course.
Also, if you don't need the basis of the cylinder, you can omit it and save some performance by not rendering this complex face. In such case, use
Cylinder, 16, -0.5,-0.5,1; (Example dimensions)
Re: Rotating Cylinders
Thanks very much Derryck, managed to sort it now, much appreciated!
Tom
Tom
Tstageman- Posts : 154
Join date : 2011-10-21
Similar topics
» Cylinders
» Rotating object
» rotating an object via a key command
» Animated sound not rotating with object
» Rotating object
» rotating an object via a key command
» Animated sound not rotating with object
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|