Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: eirsik on February 02, 2014, 01:53:32 PM
-
Hello,
Is it possible to have an object to follow the cursor?
I.e I the player can build a campfire, and when he selects the campfire the campfire model is spawned at the cursor and then the player can move the cursor around to find a nice kozy spot for hes campfire and then left mouse click and the campfire is placed.
EDIT: Forgot that the object must stick to the terrain at all times aswell, Not floating in the air.
Best
Eric
-
Hi,
use this custom action:
http://hutonggames.com/playmakerforum/index.php?topic=2921.0
once this is performed and you did hit an object, use the action "GetRayCastHitInfo" to get the position of the hit, this will be your position to set your following object to.
bye,
Jean
-
Sorry for a dumb question but where should this script be attached? To the object I want to follow cursor?
-
Hi,
it doesn't matter. Actually as I looked for this more closely, there is already an action for this built in PlayMaker "Mouse pick"
I have attached a sample.
the key is to either set the cube to layer "Ignore raycast" or set the mouse pick layer mask to only pick your terrain for example.
bye,
Jean
bye,
Jean
-
Great! Thanks!