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.

DarkBASIC Professional Discussion / Help with this please?

Author
Message
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 15th Aug 2003 00:20
ok
Ive basically got a box. it rotates 90 degreess to the left when you tell it to.
I have an sphere which in relation to the center of the box (co ordinate 0, is offset by i dont know how much. I basically want it so that when the box rotates, the sphere rotates with it.

for t=1 to 45
yrotate object 1,wrapvalue(object angle y(1)+2)
next t
rotate object t,0,0,0

this makes (or gives the impression) of the box rotateing.
My game makes the box rotate in any direction like a rubix cube, so once the box roatates it is reset to 0,0,0 (which you dont notice). The box rotates by 90 degrees each time. (moves 2 degrees, 45 times)

i thought of this code to make the object move round with it.

point object t,0,object position y(t),0
yrotate object t,-90 : move object t,200/90 : yrotate object t,90

this code is put in the for next loop shown above. It doesnt work though and i dont know y. I fany one has any better code please let me know. or if anyone can fix this code let me know. Please note that the movement of the box and the objects in it is the same. but it should be kept independant. i.e. dont say "make the box collision proof and make it force the objects round in it with it" that would be a nice idea but causes controll problems later
if you were able to understand this post then you have the mind of a genuius. If you are able to come up with the answer you should be the pri minister of england or presedent of america...or...wateva
>>TerraByte. Putting the Byte back into Terragramming<< If my post has less than 20 typos then it wasnt me who wrote it!
http://darkdayssoftware.250free.com/Logo394.GIF[/img]
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Aug 2003 00:24
Can you post your code - the snippets you gave wont help much unfortunately.


Logo design by Indi
Its better than a poke in the eye...
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 15th Aug 2003 00:56
Well, you could 'glue the sphere to the box and then when you rotate the box, the sphere goes with it! You can then unglue it if you want.

e.g.:



The programmer formerly known as sonic
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 15th Aug 2003 01:17
@ spook
ALMOST!!!!!!
um....
if i glue the object it does go round exactly how i want.
i do have to unglue it when it reaches the right place because the box has to be rotated back.

my refined code now reads

left:
glue object to limb 2,1,0
glue object to limb 3,1,0
glue object to limb 4,1,0
for t=1 to 45
yrotate object 1,wrapvalue(object angle y(1)+2)
sync
next t
unglue object 2
unglue object 3
unglue object 4
rotate object 1,0,0,0
return

unfortunatly it doesnt work compleatly
you would have thought that when you unglue an object, it leaves it where it is when it is unglued. But instead it seems when you unglue the object it moves to the center of the object it was attatched to
Is this a bug? Is there a way round it

>>TerraByte. Putting the Byte back into Terragramming<< If my post has less than 20 typos then it wasnt me who wrote it!
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 15th Aug 2003 01:19
oh i should have mentioned
objects 2,3,4 are all objects attached to the main object 1

>>TerraByte. Putting the Byte back into Terragramming<< If my post has less than 20 typos then it wasnt me who wrote it!
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 15th Aug 2003 02:02
Hmmm, I've never unglued an object so didn't realise consequences. After mucg faffing about, do the following.

imagine you are about to unglue object 2 which is glued to object 1. It is now in a different place to its start.

x#=limb position x(2,0)
y#=limb position y(2,0)
z#=limb position z(2,0)
unglue object 2
position object 2,x#,y#,z#

It's stupid that object's position does not move when glued but it's limb position does!

The programmer formerly known as sonic
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 15th Aug 2003 02:07
hehe thanks
i was thinking along the same lines...i tried object position xy and z just before unglueing (which didnt work)
cheers
so...
YEYE!!!!! WOOOOOo!!!

>>TerraByte. Putting the Byte back into Terragramming<< If my post has less than 20 typos then it wasnt me who wrote it!

Login to post a reply

Server time is: 2026-07-23 02:29:47
Your offset time is: 2026-07-23 02:29:47