Table of Contents

Class Trajectory

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

pitchDegrees float

Target local X rotation in degrees (signed -180..180 preferred).

SetupTrajectory(float, float)

public void SetupTrajectory(float force, float maxRange)

Parameters

force float
maxRange float

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

projectilePrefab GameObject

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

projectile Rigidbody

A 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()