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 / sparky pulling data from wrong collision

Author
Message
Southside Games
16
Years of Service
User Offline
Joined: 1st Jan 2010
Location: Don\'t tell me what to do!
Posted: 8th Feb 2014 20:27 Edited at: 8th Feb 2014 20:30
Hey.

I'm using sparky to see if a bullet hits its target. when it hit's it checks how far it flew to see what the odds of a critical hit are. However when I check the distance comes up zero regardless of how far I fired.

Then I found out what's going on. sparky is pulling the hit x and z cords from were the player is standing, not were the bullet hits. and because were I'm standing when I hit is the same place as were I fired. It's zero. I proved this by moving after I fired before the bullet hit. the distance is about that of how far I moved.

So I guess my question is how do I tell sparky to use the cords from the hit from the entity? What I don't get is that the bullet and player functions are called separately. And the cords from the impact should overwrite the cords from the player world collision check.


code time.

code that saves the cords were the bullet started. inside the function that makes the bullet.


this is the check for the bullets to see if they hit anything.



This is the function that would remove some health and check to see if it's a critical. but only checks the distance and removes a pre set amount of health as of now.



Thanks.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 8th Feb 2014 21:44
Take a look to raycasting.
SC_rayCast ( objNum, oldx, oldy, oldz, x, y, z, excludeObj )

I'm not a grumpy grandpa
Southside Games
16
Years of Service
User Offline
Joined: 1st Jan 2010
Location: Don\'t tell me what to do!
Posted: 9th Feb 2014 07:35
how so? like do a ray between the start pos and the hit pos? does SC_groupCollision() only tell you if two things are colliding, and not were they are colliding? easy fix I guess. Thanks.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 9th Feb 2014 13:04
Quote: "how so? like do a ray between the start pos and the hit pos? does SC_groupCollision() only tell you if two things are colliding, and not were they are colliding? easy fix I guess. Thanks."


This piece of code works with INTERSECT OBJECT , and SC_rayCast works in the same way but faster.



I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-07 01:54:25
Your offset time is: 2026-07-07 01:54:25