您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
946 B
33 行
946 B
using System;
|
|
using Unity.Mathematics;
|
|
using UnityEngine;
|
|
using UnityEngine.Experimental.Perception.Randomization.Parameters;
|
|
using UnityEngine.Experimental.Perception.Randomization.Randomizers;
|
|
|
|
namespace RandomizationTests.RandomizerTests
|
|
{
|
|
[Serializable]
|
|
[AddRandomizerMenu("Perception Tests/Example Transform Randomizer")]
|
|
public class ExampleTransformRandomizer : Randomizer
|
|
{
|
|
public Vector3Parameter position = new Vector3Parameter();
|
|
public Vector3Parameter rotation = new Vector3Parameter();
|
|
|
|
public Transform transform;
|
|
|
|
protected override void OnCreate()
|
|
{
|
|
transform = scenario.transform;
|
|
}
|
|
|
|
protected override void OnUpdate()
|
|
{
|
|
transform.position = position.Sample();
|
|
}
|
|
|
|
protected override void OnIterationStart()
|
|
{
|
|
transform.rotation = quaternion.Euler(rotation.Sample());
|
|
}
|
|
}
|
|
}
|