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.

AppGameKit Classic Chat / Area Collide? ObjectCubeCast()?

Author
Message
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 14th Jul 2016 19:30 Edited at: 14th Jul 2016 20:02
I'm working on a 3D game with a projectile bullet object.

Here is how it's currently setup:


The issue is that occasionally the bullet goes through the mesh of the enemy and no collision occurs. (Shown in Frame to Frame)

Perhaps I'm just approaching this the wrong way, any thoughts or ideas?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 14th Jul 2016 19:50 Edited at: 14th Jul 2016 19:51
SetSpritePhysicsIsBullet( iSpriteIndex, bullet )
EDIT: Oops... You said 3D. Ignore me.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 14th Jul 2016 19:52
You'll probably want a raycast to where the bullet is going to be in the next frame to check for collision.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 14th Jul 2016 20:24 Edited at: 14th Jul 2016 20:25
There's an idea, raycast from where the bullet was in frame1 to frame where it is in frame2.
There is a small chance that an enemy could hit the back of a bullet, suppose I could live with that.
Thanks!

Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 14th Jul 2016 21:37 Edited at: 14th Jul 2016 21:39
Hmmm...still having issues with it.
It works most of the time, just the occasional miss.
I think something is a miss in my code...



Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 14th Jul 2016 23:03
How about show us what commands you are using.
Are you using the 3d physics commands?
The coffee is lovely dark and deep,and I have code to write before I sleep.
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 15th Jul 2016 01:43 Edited at: 15th Jul 2016 01:45
I tried using raycast instead of spherecast, it works perfectly now. I used 2 rays so the bullet has 'volume' to it.

This is the old spherecast version:


Here is the new raycast version:
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 16th Jul 2016 20:10
It seems RayCasting doesn't work so well at sub 1.0 unit sizes.
I'll just over compensate. Problem solved
Suppose I could try scaling the entire game up...

Login to post a reply

Server time is: 2024-09-29 17:25:48
Your offset time is: 2024-09-29 17:25:48