You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.VFX.Block
|
|
{
|
|
[VFXHelpURL("Block-Gravity")]
|
|
[VFXInfo(category = "Force")]
|
|
class Gravity : VFXBlock
|
|
{
|
|
public override string name { get { return "Gravity"; } }
|
|
public override VFXContextType compatibleContexts { get { return VFXContextType.Update; } }
|
|
public override VFXDataType compatibleData { get { return VFXDataType.Particle; } }
|
|
|
|
public override IEnumerable<VFXNamedExpression> parameters
|
|
{
|
|
get
|
|
{
|
|
foreach (var p in GetExpressionsFromSlots(this))
|
|
yield return p;
|
|
|
|
yield return new VFXNamedExpression(VFXBuiltInExpression.DeltaTime, "deltaTime");
|
|
}
|
|
}
|
|
|
|
public override IEnumerable<VFXAttributeInfo> attributes
|
|
{
|
|
get
|
|
{
|
|
yield return new VFXAttributeInfo(VFXAttribute.Velocity, VFXAttributeMode.ReadWrite);
|
|
}
|
|
}
|
|
|
|
public class InputProperties
|
|
{
|
|
[Tooltip("Sets the gravity acting upon the particles.")]
|
|
public Vector Force = new Vector3(0.0f, -9.81f, 0.0f);
|
|
}
|
|
|
|
public override string source
|
|
{
|
|
get
|
|
{
|
|
return "velocity += Force * deltaTime;";
|
|
}
|
|
}
|
|
}
|
|
}
|