i wanna gizmoo for it when cotnacting change colorr of gizmoo also gizmoo line contact…
- User
i wanna gizmoo for it
when cotnacting change colorr of gizmoo
also gizmoo line contact lengthh
writee only gizmo ovoid in asnwee short answeee only gizmoo void
using UnityEngine; using UnityEngine.Events;
public class RaycastController : MonoBehaviour { public LayerMask layerMask; // The LayerMask for identifying which layers the raycast should detect. public UnityEvent onRaycastHit; // Event to be invoked when the raycast hits something. public Color gizmoColor = Color.green; // The default color for the gizmo. public float rayLength = 10f; // The length of the ray. public float stepHeight = 0.5f; // The height to step up. public float stepSpeed = 5f; // The speed for smooth interpolation during stepping.
private Color originalGizmoColor; // Backup of the original gizmo color. private Vector3 targetPosition; // The target position to achieve smooth stepping. private bool isStepping = false; // Check if currently stepping. void Start() { originalGizmoColor = gizmoColor; targetPosition = transform.position; } void Update() { Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, rayLength, layerMask)) { gizmoColor = Color.red; // Change gizmo color to red upon detection. onRaycastHit.Invoke(); // Invoke the UnityEvent. } else { gizmoColor = originalGizmoColor; } HandleCharacterStepping(); } void HandleCharacterStepping() { if (isStepping) { if (Vector3.Distance(transform.position, targetPosition) > 0.01f) { transform.position = Vector3.Lerp(transform.position, targetPosition, stepSpeed * Time.deltaTime); } else { transform.position = targetPosition; isStepping = false; } } if (Input.GetKeyDown(KeyCode.Space)) // Example condition to trigger a step up. { StartStepping(); } } void StartStepping() { targetPosition = new Vector3(transform.position.x, transform.position.y + stepHeight, transform.position.z); isStepping = true; } void OnDrawGizmos() { Gizmos.color = gizmoColor; Gizmos.DrawLine(transform.position, transform.position + transform.forward * rayLength); }}
- Assistant
void OnDrawGizmos() { Gizmos.color = gizmoColor; Gizmos.DrawLine(transform.position, transform.position + transform.forward * rayLength); } - User
its not changing color on contact
its not changing length before closeset targett in gizmoo
??
- Assistant
void OnDrawGizmos() { Gizmos.color = gizmoColor; Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, rayLength, layerMask)) { // Draw line to the hit point Gizmos.DrawLine(transform.position, hit.point); } else { // Draw line to the maximum ray length Gizmos.DrawLine(transform.position, transform.position + transform.forward * rayLength); } } - User
i wanna scriptt for wave spawning enemeis
there for example 1 level - 10 enemies 1 wave -5 2 wave - 5
also maybe wave - boss
also i wanna custom waves and enemies for that i wanna have publci varible how many what enemies i wanna i mean i wanna list of wave levels may be use serializefie publci class
and already list of it
- Assistant