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 / object collision help

Author
Message
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 9th Apr 2009 13:48
i need help with my object collision

i don't get what is wrong with it anyone know?

www.madninjas.co.nr we are mad and we are ninjas
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 9th Apr 2009 14:15
More information is needed. What's going wrong? Are you sure that the objects 1 and 3 are colliding?
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 9th Apr 2009 14:16
it says the objects do not exist but they do object 1 is a sphere and object 3 is a cube

www.madninjas.co.nr we are mad and we are ninjas
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Apr 2009 14:21
Well, they do the first time, but then you delete object three.
Try doing something like this instead:


Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 9th Apr 2009 14:24 Edited at: 9th Apr 2009 14:24
The collision will only work once, because you are deleting object 3. If the collision is being called more than once, you'll get an error.

Try:


Edit: Heh, ninja'd.
DB PROgrammer
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 9th Apr 2009 16:39 Edited at: 9th Apr 2009 16:40
Bursar's code wouldn't work, because he is still checking for collision with an object that might not exist. I'm not sure about Rudolpho's, it depends on how the compiler reads the commands, if it's left to right it won't work but if it's right to left(which I think it is) it will. Just for the sake of being simple here is the fail-safe code.




DBPro, limited by the programmer.
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 9th Apr 2009 17:46
ok um... thx i used db programmer's code and it worked but for some reson it will not make object 3 here is my code



its only a test but when it works i will change the sword to my model and add buildings (just saying to show im not making some sort of rubbish to waste your time because it will turn out good well..... i hope)

www.madninjas.co.nr we are mad and we are ninjas
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 9th Apr 2009 17:53
it is deleting it instantly

www.madninjas.co.nr we are mad and we are ninjas
DB PROgrammer
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 9th Apr 2009 21:26
It's because the objects are hitting. When you add the limbs it makes the collision box huge, which in turn, makes the objects collide.



You also had some typos I fixed. Good luck with whatever it is your doing.


DBPro, limited by the programmer.
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 9th Apr 2009 21:47
it says object already exisists (object 4) after i press E

www.madninjas.co.nr we are mad and we are ninjas
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 9th Apr 2009 23:07
That's because DBP reads keypresses so quickly, that bit of code is getting called multiple times. You have a couple of options.

The first is to add a delay until the key is released:


It's not elegant and will block your code until the key is released.

The other way is to check if the object already exists
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 9th Apr 2009 23:19
ok thx but i also used this to delete object 4 but when i try it it says "object already exists"

www.madninjas.co.nr we are mad and we are ninjas
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 10th Apr 2009 00:45
You'll need to post some more code. Something must be going wrong somewhere if you're getting an "object already exists" error when you try to delete.
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 10th Apr 2009 10:40
well then...... here is my deleting code


i dont see anything wrong with it.

www.madninjas.co.nr we are mad and we are ninjas

Login to post a reply

Server time is: 2024-11-25 08:35:02
Your offset time is: 2024-11-25 08:35:02