playMaker

Author Topic: Question about force and collisions  (Read 1302 times)

Ghostlygurustudios

  • Playmaker Newbie
  • *
  • Posts: 2
Question about force and collisions
« on: December 08, 2017, 02:48:43 AM »
I apologize if i have some how missed an example of this or someone else has asked the same or a similar question, but upon digging and trying to figure it out on my own im a bit stumped..

Let's say you have a jar of jam in your game and when you throw it when it hits a wall/floor/ceiling and it breaks.. how would you go about detecting or setting the amount of force needed in order for it to break?

So.. yup i can easily make it so when the jar of jam hits the wall/floor it breaks.. but the issue is when i am just carrying the jam and it happens to collide with the wall without me throwing it at it.. well! it also breaks..and of course it also breaks if i just drop the object on the floor.. which isnt as big of an issue but..

any way to set it up so that it has to be great than or equal to some amount of force in order for it to break?

I figure id use a float.. or few floats..and i figure it has something to do with the option under collision event of "store force"... maybe? maybe not? float compare..? probably? erg.. wait.. get collision info probably has something to do with it.. bah..

This is pretty new to me.. and i tried a couple things but.. no luck.. any tutorials or examples anyone could help me get this implemented?
« Last Edit: December 08, 2017, 03:01:02 AM by Ghostlygurustudios »

saneinsylum

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Question about force and collisions
« Reply #1 on: December 08, 2017, 02:57:31 AM »
You could add a global event in the jar that leads to a state that waits for a collision, and in your throw FSM, send that event.
it wont break until you throw it.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Question about force and collisions
« Reply #2 on: December 08, 2017, 03:49:40 AM »
Hi.
Maybe disable the collider when holding the jar?

You can also do something maybe with the 'Get Collision Info' action.
and get relative velocity or relative speed, then use a compare and if greater than....break the jar.

Ghostlygurustudios

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Question about force and collisions
« Reply #3 on: December 09, 2017, 12:38:10 AM »
Thanks for responses.. gonna give em a whirl.. and let you know how it goes..

my other issue is an odd one.. == the object i am spawning in (a sprite.. thats basically working as a splatter of jam decal) when the jar hits the wall/floor the sprite that should be loading in and showing up onto the walls/floor.. isnt always appearing on the walls/floor.. BUT.. the jar always seems to be destroyed.. so it is detecting the collision just for some reason the sprite doesnt always show.. I do have the fsm on the walls/floor instead of on the jar.. thought of adding a boxcollider2d to the sprite, but says couldnt make collider cause too small or some biz..

basically -
collision event - did collide - to..
get collision info/contact point
create object/position (contact point)-
destroy object jam jar



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Question about force and collisions
« Reply #4 on: December 09, 2017, 01:39:51 PM »
Hi,
Can you give some more information (images/video from your fsms/states/actions and the issue)

Its hard to say what the reason is.