what i was trying to do was have a place a turret on a spacesship. as the spaceship turns in 3d space it is hard to have the turret stay in the correct place..... even the code I made didnt work very well because it only worked strait along one of the axis
(like when the rotation is all zero the turret would be 0,0,10 or 0,-10,0 ect.) anyhow I have up with a simple solution...
USE LIMBS!!!!!!! THEY MAKE YOUR LIFE EASYER!!!! ALOT!!!
hard to get used to at the begining but worth it!!!
load object "turret.x",1
load object "turret barrel.x",2
load object "main ship.x",5
`just a cube so I have a mesh to make limbs with, not trealy sure
`how to get around this
make object cube 6, .1
make mesh from object 6,6
`thank you .Mr Cube but you are not needed any more. MWAHAHAHA
delet object 6
`clone the turets for the other side....
clone object 3,1
clone object 4,2
rem limbs THESE ARE SO HELPFULL ITS NOT FUNNY!!!!!!!!!!
perform checklist for object limbs 5
nl=checklist quantity()
`--/\-- you HAVE to do this even if the object doesnt have any
`limbs(or so you think...) I got 3 when I ran this on a simple
`spaceship that was NOT animated or anything.
add limb 5,nl,1
add limb 5,nl+1,1
add limb 5,nl+2,1
add limb 5,nl+3,1
`------------/\ just add the number you want here.
`forgot to say.. limbs need to be adde in sequence, 1,2,3,4,5 ect. `you CANNOT go out of turn it just doesnt work. :-)
hide limb 5,nl
hide limb 5,nl+1
hide limb 5,nl+2
hide limb 5,nl+3
`---/\---- delete those pesky cubes. you COULD make meshes of the `objects that you wanted, but i didnt like the way they worked.
`they are white and light doesnt afect them, so I I simply glue
`some objects to the limbs.
`offsets ----\/---this is where you set the limb's position.
`the limb's position is RELATIVE to the FIRST object
`(in my case the MAIN SHIP)
offset limb 5,nl,3.76,10.368,.029
offset limb 5,nl+1,-3.416,10.368,.029
offset limb 5,nl+2,4.016,10.46,.029
offset limb 5,nl+3,-3.672,10.44700,.029
`THE TOTALY AWSOME LIMBS AT WORK!!!!
glue object to limb 1,5,nl
glue object to limb 3,5,nl+1
glue object to limb 2,5,nl+2
glue object to limb 4,5,nl+3
`one final thing..... you cant rotate the object that is glued to
`the limb... BUT you CAN rotate the limb just like you would
`rotate the object. I was able to replace ROTATE OBJECT with
`ROTATE LIMB to no ill effect.
rotate limb 5,nl+2,xangle1,zangle1,110
`-------------/\ remember to use the checklist.
that code requires media but thats because its not really made to run... its just to give an idea of how it works.
I tryed to explain it as well as i could. I hope you can figure it out.
other posts:
http://forum.thegamecreators.com/?m=forum_view&t=64643&b=7
http://forum.thegamecreators.com/?m=forum_view&t=64643&b=7
Wild_Doogy