Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Collission Issues; Help! Spectacular and Precise Bullet Collission checking
Topic Started: Sep 11 2008, 08:05 AM (502 Views)
Naz
Member Avatar
Forum Leader
[ *  *  *  *  * ]
Can someone please help me out with how i can deal with how i can stop my bullets from going through walls... i ve tried working it out myself but its just not cutting.... Super programmers please make me a simple and small example or post a code... example would be nice though :-)... thanks!
May 20th, 2016
Offline Profile Quote Post Goto Top
 
Bazza
Member Avatar
Forum God
[ *  *  *  *  *  * ]
u can use raytracing.
in the bullet step event
Code:
 

near=instance_nearest(x,y,col)//use this to detemin what object your bullet is most probably going to hit make col a parent object to all models that need collisions//
dist=CheckRayIntersection(neer.id,x,y,z,roty,rotx)
if dist<5{//whatever u want it to do if it collides}
Edited by Bazza, Sep 11 2008, 08:23 AM.
My instinct is to hide in this barrel, like the wily fish.
Offline Profile Quote Post Goto Top
 
Naz
Member Avatar
Forum Leader
[ *  *  *  *  * ]
Thanks bazza... Will try it out as soon as i can.
May 20th, 2016
Offline Profile Quote Post Goto Top
 
Reikyrr
Forum God
[ *  *  *  *  *  * ]
what do you need to write at "CheckRayIntersection(neer.id,x,y,z,roty,rotx)"?
~Inspirational quote~
Offline Profile Quote Post Goto Top
 
Naz
Member Avatar
Forum Leader
[ *  *  *  *  * ]
Pardon me for being to 'questiony' lol... i ve tried it n its not exactly working... i think am missing something... here's an instance right,
My bullet object is 'killer' my wall object is 'level' and i want when the bullet hits the wall it gets destroyed instantly! Could you code out this instance using the names i ve given. Thanks Bazza
May 20th, 2016
Offline Profile Quote Post Goto Top
 
Bazza
Member Avatar
Forum God
[ *  *  *  *  *  * ]
are u using multiple walls?
My instinct is to hide in this barrel, like the wily fish.
Offline Profile Quote Post Goto Top
 
Gandalf20000
Member Avatar
Geek
[ *  *  *  *  *  * ]
Ray tracing is perfect for this. However, you have to make sure that any object that you're trying to collide with has SetObjectSolidity(true,<insert true or false here, it really depends on the situation>) in it.
Offline Profile Quote Post Goto Top
 
Naz
Member Avatar
Forum Leader
[ *  *  *  *  * ]
bazza games
Sep 26 2008, 01:05 PM
are u using multiple walls?
No, i dont think so...
May 20th, 2016
Offline Profile Quote Post Goto Top
 
Naz
Member Avatar
Forum Leader
[ *  *  *  *  * ]
Gandalf20000
Sep 26 2008, 03:18 PM
Ray tracing is perfect for this. However, you have to make sure that any object that you're trying to collide with has SetObjectSolidity(true,<insert true or false here, it really depends on the situation>) in it.
Oh ray tracing... not sure exactly how to use it... :dunno:
May 20th, 2016
Offline Profile Quote Post Goto Top
 
Gandalf20000
Member Avatar
Geek
[ *  *  *  *  *  * ]
CheckRayIntersection(ObjectID,x,y,z,rotx,roty,room) is what you need for ray tracing.
Then you make any object you want solid. You could use it like this in your bullet:
Code:
 

distance=CheckRayIntersection(all,x,y,z,rotx,roty,-1)
if distance<3
{
instance_destroy()
}

This way, if a bullet hits a solid object, it's destroyed.
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply