Class Trajectory
- Namespace
- WitShells.ShootingSystem
public class Trajectory : MonoBehaviour
- Inheritance
-
Trajectory
Fields
OnProjectileLaunched
public UnityEvent<Transform> OnProjectileLaunched
Field Value
- UnityEvent<Transform>
Methods
Hide()
Manually hide the trajectory (disables the line renderer and hides the indicator).
public void Hide()
SetTurretTiltInstant(float)
Instantly set the turret (launch point) local X rotation (pitch) to the given degrees clamped between WitShells.ShootingSystem.Trajectory.minTiltAngle and WitShells.ShootingSystem.Trajectory.maxTiltAngle. Useful for snapping the aim to a known tilt value.
public void SetTurretTiltInstant(float pitchDegrees)
Parameters
pitchDegreesfloatTarget local X rotation in degrees (signed -180..180 preferred).
SetupTrajectory(float, float)
public void SetupTrajectory(float force, float maxRange)
Parameters
ShootProjectile(GameObject)
Convenience overload: instantiate a prefab that has a Rigidbody and launch it. Returns the spawned Rigidbody or null if spawn/rigidbody not available.
public Rigidbody ShootProjectile(GameObject projectilePrefab)
Parameters
projectilePrefabGameObject
Returns
- Rigidbody
ShootProjectile(Rigidbody)
Launches the provided Rigidbody as a projectile from the launch point using the configured WitShells.ShootingSystem.Trajectory.launchForce. The Rigidbody will have its position/rotation set to the launch point and its velocity assigned so physics takes over.
public void ShootProjectile(Rigidbody projectile)
Parameters
projectileRigidbodyA Rigidbody instance (can be a pooled object). Must not be null.
Show()
Manually show the trajectory (enables the line renderer and indicator).
public void Show()