Raycast Flashcards

1
Q

Real-Time Physics Engines:

A

Purpose:
Designed for applications requiring fast and responsive simulations, such as video games.

Accuracy:
Sacrifices precision for speed to ensure smooth and real-time interactions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

High-Precision Physics Engines:

A

Purpose:
Used in applications where accuracy is crucial, such as scientific simulations or engineering analyses.

Accuracy:
Prioritizes precision over speed to provide accurate and reliable results.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Soft-Body vs Rigid-Body Physics Simulations:

A

Rigid-Body Physics Simulations:
Description:
Models objects as rigid bodies, maintaining shape during interactions.
Use Cases:
Suitable for simulating solid objects like cars, buildings, or simple interactions without significant deformation.
Example:
Simulating the collision and movement of billiard balls.

Soft-Body Physics Simulations:
Description:
Models objects as deformable structures, allowing changes in shape and flexibility.
Use Cases:
Ideal for simulating materials like cloth, rubber, or biological tissues where deformation is crucial.
Example:
Simulating the movement and interaction of a flag in the wind.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a Raycast?

A

Definition:
A technique in computer graphics and game development to determine objects along a line in 3D space.

Use in Unity:
Often cast from a point in a specific direction for tasks like shooting projectiles, determining line of sight, or interacting with distant objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How Raycasts Work Internally in Unity:

A

nternal Process:
Unity’s raycasting system uses physics engine functionality to cast a ray into the scene, detecting intersections with colliders.

The physics engine traces the ray’s path, reporting collisions or intersections with objects having colliders.

Developers use this information to implement various gameplay features.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Raycast Hit?

A

Definition:
A data structure containing information about what was hit during a raycast.

Contents:
Stores details such as the hit object, point of intersection, normal of the surface, and distance from the ray’s origin.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Types of Raycasts:

A

Physics.Raycast:
Casts a ray from a specified origin in a specified direction, returning true if it hits any collider within a set distance.

Physics.Linecast:
Similar to Raycast but for casting a line segment between two points.

Physics.BoxCast:
Casts a box-shaped volume along a ray, providing information about the first collider hit.

Physics.SphereCast:
Casts a sphere-shaped volume and retrieves information about the first collider it hits.

Physics.CapsuleCast:
Casts a capsule-shaped volume, returning information about the first collider it intersects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are Overlap Volumes?

A

Definition:
Trigger colliders in Unity detecting when other colliders enter or exit a specific area in the game world.

Implementation:
Utilize Unity’s Collider components with “Is Trigger” property enabled (e.g., BoxCollider, SphereCollider, CapsuleCollider, or MeshCollider for convex shapes).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Examples of Overlap Volumes:

A

Checkpoint Zones:
Used in racing games at various checkpoints on the track to trigger checkpoint events when a player’s vehicle enters.

Collectibles Areas:
Applied in games with scattered collectible items, triggering collection events when a player’s character overlaps with the area.

Enemy Detection Zones:
Placed in stealth games around an enemy’s field of view, triggering awareness when a player character enters the volume.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Usefulness of Overlap Volumes:

A

Event Triggers:
Used to trigger specific events or behaviors when a GameObject enters or exits the volume.

Area-of-Effect (AoE) Effects:
Define areas for effects like damage or buffs applied to entities within the volume.

Zone-Based Logic:
Helpful for implementing game mechanics dependent on the spatial relationship between GameObjects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Checking Overlap Volumes in Unity:

A

Methods:
Use OnTriggerEnter, OnTriggerExit, and OnTriggerStay methods in scripts.

Functionality:
Automatically called when a GameObject with a collider marked as a trigger enters, exits, or stays within the overlap volume.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly