Download data/Assets/Scripts/Common/PSMCartisianUserControl.cs from introvoyz042/CRESSim: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/introvoyz042/CRESSim/resolve/main/data/Assets/Scripts/Common/PSMCartisianUserControl.cs
- Command line
-
hf download hf://datasets/introvoyz042/CRESSim/data/Assets/Scripts/Common/PSMCartisianUserControl.cs
-
curl -L -o PSMCartisianUserControl.cs https://huggingface.co/datasets/introvoyz042/CRESSim/resolve/main/data/Assets/Scripts/Common/PSMCartisianUserControl.cs
1.44 kB
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using PhysX5ForUnity; | |
| public class PSMCartisianUserControl : MonoBehaviour | |
| { | |
| public float moveSpeed = 5.0f; | |
| public float verticalSpeed = 5.0f; | |
| private void Start() | |
| { | |
| Transform existingTransform = m_robotEETooltip.transform; // reference to an existing transform | |
| m_transformEE.position = existingTransform.position; | |
| m_transformEE.quaternion = existingTransform.rotation; | |
| } | |
| void FixedUpdate() | |
| { | |
| // Get horizontal and vertical input from the left joystick | |
| float horizontalInput = Input.GetAxis("Horizontal"); | |
| float verticalInput = Input.GetAxis("Vertical"); | |
| // Get input from the right trigger for up/down movement | |
| float triggerInput = Input.GetAxis("3rd axis"); // Change this to match your input settings | |
| // Calculate the movement vector in the horizontal plane | |
| Vector3 moveDirection = new Vector3(horizontalInput, triggerInput, verticalInput) * moveSpeed * Time.fixedDeltaTime; | |
| // Move the game object | |
| m_transformEE.position += moveDirection; | |
| m_controller.DriveCartesianPose(m_transformEE); | |
| } | |
| [] | |
| PSMControllerBase m_controller; | |
| [] | |
| private PhysxArticulationRobot m_robot; | |
| [] | |
| GameObject m_robotEETooltip; | |
| private PxTransformData m_transformEE; | |
| } | |