Is there a way to get and store a Physic Material in a variable in Play Maker?
I am new to making custom actions in PlayMaker, but I have been giving it a try! I seem to have it backwards though, my custom action will let me SET a Physics Material, but I just want it to GET which physic material an object has. (I would like to pass it as a variable to this "Get Physic Material Properties" action I got from the ecosystem)
I have a scene full of objects with different physics materials on them, and have an FSM that can get certain properties and print their values to a little label that hovers over the object (like it will print the "dynamic friction" and "static friction" values for example).
The label printing FSM is working so far. it is able to grab the properties I need from whatever physics material I pick in the little Physic Material slot on the "Get Physic Material Properties" action. I just can't figure out what kind of variable I can store this specific property (the physic material itself) in so I can pass it to that Get Physic Material Action. I would eventually be using this to iterate over a bunch of items so I don't have to do this for each one by hand.
Here is my attempt at a Custom "Get Physics Material" script. There does not seem to be a variable type "FsmPhysicMaterial". I tried FsmObject but it didn't work either, and yeah, I'm super new making custom actions, any advice is appreciated!
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Physics)]
public class CustomGetPhysicsMaterial : FsmStateAction
{
public FsmGameObject scriptOwner;
public PhysicMaterial physicsMat;
// Code that runs on entering the state.
public override void OnEnter()
{
physicsMat = scriptOwner.Value.gameObject.GetComponent<Collider>().material;
Finish();
}
}
}
Your answer
Follow this Question
Related Questions
How to get Physic material using Playmaker? 0 Answers
How to get Physic material using Playmaker? 0 Answers
How do i change a color of an individual alphabet of a UI.Text 2 Answers
Display pictures in assets folder in random order 0 Answers
How do I create an undertale player health bar in C#? 1 Answer