Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Vink on December 04, 2012, 05:55:02 AM
-
Hello every
Im wandering if there is a way to use playmaker to detect particle collision?
i just made a pretty cool particle system where it looks like the thing is shooting spikes, i managed to make playmaker turn the "emit" on and off with left click and it automatically detects collision when it hits other colliders and destroys the particles, i had a look at "get collision info" and tried using that to store the game object it hits, but i couldnt figure it out
im using an empty game object with these components: Ellipsoid particle emitter, particle animator, particle renderer and world particle collider
-
This would take a little work to hook up in Playmaker.
The general Unity approach is described here:
http://answers.unity3d.com/questions/10717/detecting-particle-collisions.html
However, PlayMakerFSMs don't currently respond to the OnParticleCollision event. You could make a small proxy script that forwards the event to a PlayMakerFSM on the same object... I'll try to find some time to code that, or perhaps someone else will jump in :)
I'll look into getting this event into a Playmaker update... it would be cool :)
-
Hi!
Is it any update on this? I'm trying to do the same.
-
Four years later and noone did this little proxy script ever?...
-
I threw one together really quickly just now- its attached or here https://snipt.net/mdotstrange/particlecollisionpm/ (https://snipt.net/mdotstrange/particlecollisionpm/)
To use it add it to your particle system object- make sure the particle system has Collisions on- set the collisions to world and also check Send Collision Messages
The script will send an event called "Hit" to an Fsm on the Particle System object- it also sends the hit position as a Vector3 you can grab with "Get event info"
Add script and an fsm to the game object with Particle System
(http://i.imgur.com/99p3xOP.png)
Particle system collision setup
(http://i.imgur.com/NTkNgAT.png)
"Hit" event sends hit position vector3
(http://i.imgur.com/0tVcnGH.png)
-
Hi, mdotstrange!
Thank you for this! Just a question.
In the Collision on the Particle System, I don't have Collision Mode and some other options there like you have in the screenshot here.
-
What version of Unity are you using? I'm on 5.3 so maybe those options are from a newer version?
-
I have 5.2, so it's probably in the newer version. But it works anyway. :)
I tried to create a particle which will damage the player, but it didn't work. Does it only works witch particles which are already in the scene?
-
I don't understand what you are asking- You have to apply the script to any particle system you have in the scene- and it will send hit events for the hits that system collides with- you can do whatever you want with the hit data- use it to damage enemies or whatever you'd like-
-
Forget it! It works fine! :)
Again, thank you for this! :)
-
Awesome :)
-
Such a useful Script, Thx! Wish I'd seen it earlier.
-
Attached the script since snipt is no longer.
-
It's very useful script, but to be honest, I don't think we need it anymore, since Playmaker has "On Particle Collision" now. It works very well. :)
-
It's very useful script, but to be honest, I don't think we need it anymore, since Playmaker has "On Particle Collision" now. It works very well. :)
Care to elaborate on how to use this? I can't seem to grab the normal or hit point of the particle against an object with just PM. I must be missing something.
-
It's very useful script, but to be honest, I don't think we need it anymore, since Playmaker has "On Particle Collision" now. It works very well. :)
Care to elaborate on how to use this? I can't seem to grab the normal or hit point of the particle against an object with just PM. I must be missing something.
Hi!
On the particle you want to collide with, did you enable "Send Collision Message" on the Collision? You also need to change the Collision Mode depend if you use 2D or 3D Collider. If you set up the collision FSM on the particle you want to collide with, you need Rigid Body on the particle.
The last thing, on the Collision Event, you need to choose "On Particle Collision." Maybe you already did this.
Tell me if it works or not. :)
-
It's very useful script, but to be honest, I don't think we need it anymore, since Playmaker has "On Particle Collision" now. It works very well. :)
Care to elaborate on how to use this? I can't seem to grab the normal or hit point of the particle against an object with just PM. I must be missing something.
Hi!
On the particle you want to collide with, did you enable "Send Collision Message" on the Collision? You also need to change the Collision Mode depend if you use 2D or 3D Collider. If you set up the collision FSM on the particle you want to collide with, you need Rigid Body on the particle.
The last thing, on the Collision Event, you need to choose "On Particle Collision." Maybe you already did this.
Tell me if it works or not. :)
hi, well this much works but what action do I use to gather more data? The collision event only has the hit object and force, but I want the location point the particle is hitting... but everything I try after collision event isn't giving me any additional values so what would you use? Get collision info returns zeros, physics is working and the event is triggering though.
-
hi, well this much works but what action do I use to gather more data? The collision event only has the hit object and force, but I want the location point the particle is hitting... but everything I try after collision event isn't giving me any additional values so what would you use? Get collision info returns zeros, physics is working and the event is triggering though.
Hi!
I'm not really sure how to do it, if it's possible. I tried to "Get Collision Info" when I collide with particles and store everything in variables. The only thing which was stored, was the player.
I tried to do the same with a normal Game Object, then it stored everything.
Maybe Jean Fabre can explain if it's possible. :)
-
yes, I don't think all the data is passed through PM even though they added that new collision event stuff in PM. So forget that...
good news is mdotstrange's script works AWESOME and does what I need! Thank you mdotstrange.
-
Have you tried to use Get Event Info?
-
Have you tried to use Get Event Info?
Yes, when I was trying that method. Only thing it would ever get is only what the game object was for collisions unless I missed something there. (It's quite annoying to experiment with to be honest as you start scouring the dozens and dozens of particle settings, rigidbody settings, etc looking for a problem, etc) so I'll stick with the script version. It's working fine!
-
I can't get this script to work. I am also trying to do this in 2d if that makes a difference(which it probably does). Also in visual studio when I took a look at the script it said a line was deprecated, but I'm not sure how to update it. Anyone available to take a look? I am ultimately trying to get the point of contact from the particle collisions to spawn something there.
-
What is deprecated, we'll just take a look at documentation and update it.
-
I did look at it but it says to change it to a list and I am not very familiar with lists. I tried changing it but the things i tried didn’t work.
-
Figures I would post that and then I get it to compile but I still can't get it to pass the event data. I will keep working with it though.
Edit*** And then after I posted this I got it to work with the new updated code, so never mind... ;D
-
Just a note,
It only works if the hit object has a rigid body. I modified the script a bit so it works on all objects and added an FSM public variable where you put your FSM component into. If you have more than one FSM on the object this makes sense.