# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### Newcomers DBPro Corner / EZRotate "Orbiting" Door Demo question.

Message
Posted: 7th Sep 2013 19:16
Greeting! I am trying to figure out the Demo program "Orbiting" for EZRotate. I am writing a program by which Double Doors open to the inside then close as you pass thru and the reverse. Basically one direction open then close. I will be using 2 Door objects (Wood Door Left and Wood Door Right). In the demo, the 3rd Mode is what I want for the Wood Door Right, but for the life of me I cannot figure out how to change the direction on Mode #2 (Left side) to go the other way for Wood Door Left. Where in the EZRotate code points the direction which way the door will rotate? I tried different parameters, some which created fun interesting results, but not a direction change.
Posted: 8th Sep 2013 20:27
OK, I was able to get the demo to work. Now my problem is applying it to my program. I am very confused with EZro_Orbit command. When I apply it I still get the Center of the object rotating, not the right offset. Here is the cliplet of what is called:

rem ===== Load Wood Door #1 here =======
MAKE OBJECT BOX 31,55,78,5
POSITION OBJECT 31,1800,543,-1950
YROTATE OBJECT 31,90
LOAD IMAGE "dungeon/Wood Door.jpg",1
TEXTURE OBJECT 31,1

do

Rem =====Open Wood Door #1 here ========

IF int(px#) = 1840 and direction = 0 and DoorAngle >90 and int(pz#) > -1985 and int(pz#) < -1914 then Direction = 1: gosub opendoor

loop
end

opendoor:
for xx = 1 to 90
`Setup EZrotate with object's current rotation
EZro_SetEuler OBJECT ANGLE X(31),OBJECT ANGLE Y(31),OBJECT ANGLE Z(31)
`Setup EZrotate with object's current position
EZro_SetPos OBJECT POSITION X(31),OBJECT POSITION Y(31),OBJECT POSITION Z(31)

`Orbit Object on Left Side of Door
IF direction = 0
EZro_Orbit 1,1800,543,-1950,1800,543,-1950,1
DoorAngle = DoorAngle + 1
ENDIF

IF direction = 1
EZro_Orbit 1,1800,543,-1950,1800,543,-1950,-1
DoorAngle = DoorAngle - 1
ENDIF

`CALCULATE new Euler angles for object
EZro_FindEuler

`Apply new Rotation to Object
ROTATE OBJECT 31,EZro_GetEulerX(),EZro_GetEulerY(),EZro_GetEulerZ()
`Apply new Position to Object
POSITION OBJECT 31,EZro_GetPosX(),EZro_GetPosY(),EZro_GetPosZ()
next xx
RETURN

I am trying to at least get the door to open first. I am guessing the the coordinates for EZro_Orbit is the position of the Object. I am in no way a math major but I could use some help with this one please.

Old Programmer's are not ugly; they are just Visually BASIC.