Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: SammyJoeUK on October 16, 2016, 08:04:17 AM
-
So I currently have a project where there is Set Velocity movement as soon as the game starts.
However, when it collides with the cube, I want to be able to stop the velocity movement, currently when I move the obstacle, the velocity continues. I've tried using a trigger on collision but the moving object passes right through and continues.
Any ideas on how I can Zero Out/Change Object Velocity?
-
Hi,
you can use 'Collision Event' and in the next state use a 'set velocity' and set your velocity to 0
-
Hey thanks for getting back to me so quick - just gave this a go but it's still not happening. Once the stopping block is moved out the way, the velocity continues.
:(
-
Hi,
That should work
can you show the fsm/states/actions?
-
Does it matter if I place it on the moveable character or the blocking object provided it points to the right places?
-
Hi,
The collision event works on the object that the fsm is on
The Set velocity is standard on 'use owner' but you can change this by selecting 'specify game object' then you can drag in an object or use a variable.
So if you have it on the blocking object you need to 'specify game object' and drag in the movable character
If its on the movable character you can leave it on 'use owner'
also be sure that your set velocity on the start is not set to every frame.
-
Think I've got it, had it set to Collision Stay rather than Collision Enter! :D
Thanks so much for your help man! :)
EDIT: Why would cloning the object not work with the same code added? Just tried to add a second blocker (with the new set velocity set in an FSM on it) and it's not working?
-
Hi,
That depends on how you have set up your fsm's
if you can show how you set up your fsm's/states/actions i can help you in the right direction
-
Hey, sorry I've been away from my desk for a couple days.
Here's the playmaker window from the object in question...
(http://oi63.tinypic.com/vhcbhy.jpg)
(http://oi65.tinypic.com/2r2sx2x.jpg)
Thanks again bud :)
-
Hi,
Every Frame should not be enabled on Blockade and on charholder.
-
If I disable every frame on the charHolder, the cube grinds to a halt on it's way to hitting the blockade
If I disable every frame on the blockade, if I want to push the charHolder back on collision, it doesn't move.
:(
-
Hi,
Both should be disabled.
i made a quick sample video :
-
Thank you so much for the video! I think i've found my problem. I've had the Rigidbody "Use Gravity" ticked on my player character so when every frame was unticked - it would just grind to a halt halfway to the blocker.
I will need gravity applied to the character though, is there any way to remedy this?
-
Hi,
Thank you so much for the video! I think i've found my problem. I've had the Rigidbody "Use Gravity" ticked on my player character so when every frame was unticked - it would just grind to a halt halfway to the blocker.
Can you show this in a video
-
https://www.youtube.com/watch?v=1-FpHPxbdcY (https://www.youtube.com/watch?v=1-FpHPxbdcY)
As requested. Hope this helps illustrate the problem.
-
Hi,
I made a video with some solutions, i hope these help you out :
here you can find the user tutorial wiki page (https://hutonggames.fogbugz.com/default.asp?W548)
-
Awesome! Will take a look and let you know - thanks so much for your help!
-
That's worked brilliantly! Thank you! :D
One final quick question - how much would setting velocity to "every frame" affect performance?
-
Hi,
I don't know how much.
You can test this by looking to the profiler
But should alway try if you can do something without using every frame.
Things that affect performance a lot are Creating objects and finding objects