## How to rotate objects on the x and y axis?

Kasofa1
Private First Class
Posts: 101
Joined: Thu Feb 19, 2009 7:09 pm

### How to rotate objects on the x and y axis?

How does one rotate objects (like arcs) along the x or y axis?
Like to know, I have an interesting map idea.

-K
I can get a positive score; I just choose not to.

mrapple
Sergeant Major
Posts: 460
Joined: Wed May 27, 2009 11:59 am
Location: Unknown
Contact:

### Re: How to rotate objects on the x and y axis?

no you can not. you will have to create a mesh to do this.

Kasofa1
Private First Class
Posts: 101
Joined: Thu Feb 19, 2009 7:09 pm

### Re: How to rotate objects on the x and y axis?

I think it can, what about the treads in the 'Two Tanks, Laser Sniping' map?
I was thinking something along the lines of a train, probably a steam engine sort of thing.

-K
I can get a positive score; I just choose not to.

Tanx
Private First Class
Posts: 125
Joined: Sat Mar 22, 2008 11:14 pm

### Re: How to rotate objects on the x and y axis?

Actually you can with spin
known as: Tanx, Eoncho, ckw.
Bzflag player since 2001.

optic delusion
Special Forces
Posts: 1011
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

### Re: How to rotate objects on the x and y axis?

sure you can. Use spin. You can use it more than once. Do the spin in each axis seperately. I got this out of an old map of mine.

Code: Select all

``````textureMatrix
name tunspin1
spin 0.3
end
material
name tunnel1
specular 0.5 0.5 0.5 1
texmat tunspin1
end

arc
position 0 112 0
shift  0 0 397
size 15 15 183
angle 360
ratio 0.03
divisions 32
spin 90 1 0 0  #spins 90 degrees in x
spin 135 0 0 1 #spins 135 degrees in z
texsize 2 1 2 1
inside matref tunnel1
end
``````
That's not a great way of doing it, because using spin multiple times can change an object's location, as well as it's orientation. It's hard to predict where you'll end up. The easiest way to do it might be..... spin it before moving it.

1. Make the arc so it's center is at point 0 0 0. The center, not the bottom, must be at 0 0 0, so if it's ten units tall, make it's position 0 0 -5.
2. Spin the arc into the rotation you want.
3. Use define and group to shift the arc to it's final location.
Last edited by optic delusion on Wed Oct 07, 2009 11:24 pm, edited 2 times in total.
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.

khazhyk
Private First Class
Posts: 1400
Joined: Sun Feb 06, 2005 5:40 pm
Location: Somewhere over there.
Contact:

### Re: How to rotate objects on the x and y axis?

You can rotate arcs, meshboxes, meshpyrs, spheres, cones, and meshes using the 'spin' property.
It will not work with normal boxes or pyramids as far as I know.

Spin works as such:
spin angle nx ny nz
where 'angle' is the angle, turning clockwise. nx, ny, and nz are true/false toggles, which change on which axis you rotate the object. if nx is '1', and ny and nz are 0, then you will turn on the x axis. iirc, you can only spin on one axis at a time, which is okay, because you can repeat spin as much as you want.

for example:

Code: Select all

``````meshbox
name yay
shift 0 0 0 #it doesn't move
scale 10 10 30 # it's 10 by 10 by thirty units big
spin 90 1 0 0 # spins 90degrees on the x axis
spin 23 0 0 1 # spins 23degrees on the z axis
spin 45 0 1 0 # spins 45degrees on the y axis.
``````
Edit: oh hey, looks like someone beat me to it. sadface

optic delusion
Special Forces
Posts: 1011
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

### Re: How to rotate objects on the x and y axis?

wow, 4 other posts while i was editing mine...
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.

blast
General
Posts: 4791
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

### Re: How to rotate objects on the x and y axis?

You should be able to spin regular boxes and pyramids as well if you have a new enough bzfs version, but I haven't tested that.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)