playMaker

Author Topic: Character Motor Gravity Action?  (Read 2159 times)

Daphnis26

  • Playmaker Newbie
  • *
  • Posts: 6
Character Motor Gravity Action?
« on: October 04, 2013, 04:53:13 PM »
Hi, I'm using the Character Motor component that comes with Unity, and I really need to be able to change the gravity setting with Playmaker. I've tried a few things but haven't been able to make it work.

I've written a c# script which is great for basic things, such as on trigger enter, but I'm not great using scripts to do more intricate work. It would be great to be able to set this parameter with Playmaker.

This is my script.

using UnityEngine;
using System.Collections;
 
public class Gravity : MonoBehaviour
{
    void OnTriggerEnter(Collider other)
    {
        CharacterMotor motor = other.GetComponent<CharacterMotor>();
        if (motor) // if "other" has such script...
        {
            motor.movement.gravity = 5; // set its gravity
        }
    }
}

Could I write a script that just straight up gives me access to the parameter in Playmaker, or perhaps even write an action script?

Thnak you!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Character Motor Gravity Action?
« Reply #1 on: October 08, 2013, 03:12:13 AM »
Hi,

 using "Set property" action  on the character controller shoudl give you access to that gravity property. Have you tried that?

bye,

 Jean