"On Contact" node issue (not a bug)

Not sure if this is user error or need to update SDK or…?

I’m trying to swap an object without the “PhysicsBreak” for an object with the “PhysicsBreak” but it crashes at the swap. I’ve tried to trouble shoot to the best of my ability but not sure what to check or what I’m doing wrong or if I should be including another node like, " Get First Contact"

Thanks for any help you feel like giving! (including possible trouble shooting steps that I might have missed).

Here’s my file if you want to see the setup… (it’s just a crude test)

(node setup attached to “bullet” - press “Space” to fire… freezes after first contact)

Hi, @radeoflier,

This not an SDK bug, rather a user error. I have made the following changes to your blend file so what you expect happens:

"FireTest" node tree:

  • Change Keyboard node Down to Started. (Trigger only once per key press)

  • Spawn Object node Object field was empty; Set it to “bullet” object to spawn “bullet” and not “gun”.

  • Alter Apply Impulse node input; Impulse field is set to a constant value. Since the “bullet” object has to move on +Y axis, I give impulse only in that direction

"PhyscisSwitch" node tree:

  • Set the Object variable node value to “target” object

  • Remove Object nodes field was empty; set to “target” to remove object without PhysicsBreak

  • Spawn Object node Object field was empty. This means that “bullet” would have spawned, but you needed “target.001” object to spawn instead. So, set it to “target.001”

  • Disconnect Canvas nodes, since the canvas was not included in the blend file.

Apart from the above mentioned, there is also a logical issue in the chain of events. That is the trigger that happens only when the “bullet” hits “target”. Therefore you need to press space twice; 1). To trigger the change from “target” to “target.001” and 2). To break the now newly spawned “target.001”.

This can be overcome by using a Physics Trigger of a bigger size.

FireTest.blend (978.2 KB)

Best Regards,
QC

1 Like

Awesomse - I figured it was user error, but for some reason I couldn’t spot it.

I knew about the logical error (space bar twice) but was trying to isolate events for trouble-shooting. I’m not even sure this is the solution that I ultimately want (asteroids-type game) but wanted a simple test environment to see where my fail was.

Thank you so much!

1 Like

UPDATE:
I think we might just some things differently in regard to the first three bullets-points; my fire setup was design to work on a object moving through 3D space - subtract location from aim point and you can skip converting Quat to Euler or using “local axis” settings which don’t always work as expected (but maybe my Trig. is wrong?). Also it’s a “bullet storm” game so it uses constant fire which is why “down” and not “started” was used for “On Keyboard.”

But on the last three, I’m not sure why there were blank fields… that was strange because I went back and checked my file and they weren’t empty. However, when I opened your file it had blank fields, too. I re-downloaded and installed SDK (2020-10) and now everything in my original file (and yours) works as expected. I’m guessing that there was something between versions that got junked up on my system.

Thank you again for looking at my file and getting to this so quickly - that was awesome and helpful!!!