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.

Dark GDK / Bullet collision point

Author
Message
xix psycho xix
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 5th Oct 2008 21:22
I want to be able to get the point at which a bullet collided with an object so that i can position a bullet hole there, but also if you shoot a target such as a bale of hay model with an image of a bulls-eye on it you will be assigned points based on how well-placed the shot was, i.e. if you hit the bulls-eye in an outer ring you get one point, middle ring two points, and inner ring three. I just can't seem to come up with a way to compute where the hit occurred. Does anyone have any advice on something like this?
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 5th Oct 2008 23:57
Have the bulls-eye as a separate limb. You can easily find where the bullet hit, using intersect object or using sparky's dll. Once you have the bullet hole position, check how far it is from the bulls-eye limb's world position. From that you can work out which ring it was in.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
xix psycho xix
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 6th Oct 2008 04:18 Edited at: 6th Oct 2008 07:23
where can i get sparky's dll? How is the dll used with c++? The online post is very confusing. i'm not sure how to interface a dll file into c++ without making it into a library....
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 7th Oct 2008 01:03 Edited at: 7th Oct 2008 01:09
http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

You can find Sparky's collision there. Using it with DGDK is easy, just download the GDK version and setup VC++'s Include and Lib directories. Then just include 'SC_Collision.h' and use the functions like normal.

EDIT::

Sorry for this edit, just testing my sig because I found out it was linking to the image instead of the thread.

xix psycho xix
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 7th Oct 2008 03:23
well, i have my bullet class defined as an object that flies through the air and hits the target. how can i use the collision between the bullet object and the object shot at to position the bullet hole? The problem is i dont even know where to start. I looked at the stuff for sparky's and it doesnt seem to be what i need.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 7th Oct 2008 05:13
I don't have time to write up any real code right now but here's what I'm thinking...

1. Use dbIntersectObject( ) to find the distance from your player to whatever you're shooting.

2. Use dbMoveObject( ) to move your player forward the same distance that you got from dbIntersectObject( ). This will place you at exactly the point that you shot at. Save the coordinates in a variable.

3. Move your player back by the distance you moved him forward.

...and there ya go. Now you have the absolute position of the point which you shot at. You can use this for placing decals, awarding points based on what/where you shot, etc.

xix psycho xix
16
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 8th Oct 2008 17:10
Ok, but like i said, i already have a bullet class that shoots a sphere at whatever you are pointing at. How can i find out where that sphere that is being shot collided with the object that was shot at? I would rather use an object collision than a bullet calculation so that I can easily change the bullet speed; I just don't know how to see where that bullet object collided with the target.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 8th Oct 2008 22:08
Wait until the bullet is currently colliding with target, then get it's position. And you'll want Sparky's for that, as it's much faster than DBP's collision.

Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 9th Oct 2008 00:50
@AndrewT'
Where is the IntersectObject in ObjectGDK?

How do I use DarkPhysics in ObjectGDK insted of Sparkys?

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 9th Oct 2008 01:30 Edited at: 9th Oct 2008 01:33
Quote: "Where is the IntersectObject in ObjectGDK?"


In ISceneDevice. It's called 'Intersect' rather than 'IntersectObject' but I can change that for the nest update if it's more convenient. Post any changes you'd like to see in my thread, just click my sig to get there. I've really got to start making some docs for ObjectGDK. Even I had I have to look through the header files to see where some functions are!

Quote: "How do I use DarkPhysics in ObjectGDK insted of Sparkys?"


You can put '#define USE_PHYSICS' at the top of your code right before you include ObjectGDK.h if you want to use DarkPhysics, then create a pointer to IPhysicsDevice and you can use that to make rigid bodies. I'll be adding more DP features later. And ATM you're required to have sparky's collision, I'll try and remove that later but since it's free it doesn't really matter much.

Login to post a reply

Server time is: 2024-09-30 07:22:54
Your offset time is: 2024-09-30 07:22:54