Physics/RayWorldIntersectionAR

From Blue Mars Developer Guidebook

Jump to: navigation, search


This is a Physics function.

Contents

Overview

Function

This function is an extended version of RayWorldIntersection


RayWorldIntersectionAR(src, dir, maxHits, entityTypes, flags, skipEntity2, hitTable)
perform a raycast and check for intersections
src - start position of raycast, a vector
dir - direction of raycast, a vector
maxHits - maximum number of hits to register, a number
entityTypes - bit flags specifying the types of entities to register
flags - ID of entity to ignore (typically object at raycast source)
skipEntity2 - ID of another entity to ignore (typically object at raycast target)
hitTable - a Lua table in which the intersection results are returned

Entity Types

The entity types:

ent_static
ent_sleeping_rigid
ent_rigid
ent_living
ent_independent
ent_terrain
ent_all
ent_sort_by_mass

Flags

Unlike RayWorldIntersection, this function allows specification of the collision flags used for the raycast.

  • rwi_ignore_terrain_holes
  • rwi_ignore_noncolliding
  • rwi_ignore_back_faces
  • rwi_ignore_solid_back_faces
  • rwi_stop_at_pierceable
  • rwi_pierceability_mask (same as rwi_stop_at_pierceable)
  • rwi_colltype_any
  • rwi_queue
  • rwi_force_pierceable_noncoll
  • rwi_reuse_last_hit
  • rwi_update_last_hit
  • rwi_any_hit
  • rwi_colltype_bit (not a mask - use to shift)

Hit Table

This function fills in the hit table with the same result values, but with the addition of a type field.


pos 
vector - position of the intersection
normal 
vector - normal of the collision surface at the intersection
dist 
float - distance from the ray origin to the intersection
entity 
entity - intersecting entity (if it's an entity)
renderNode 
{{{p5type}}} - {{{p5doc}}}
surface_idx 
{{{p6type}}} - {{{p6doc}}}
type 
{{{p7type}}} - {{{p7doc}}}

Usage

This function can be used in conjunction with System.UnprojectFromScreen to perform mouse picking/selection.

Print MouseOver is an example entity script that displays the intersection results as you move the mouse over portions of the screen.

Some convenience functions are available for use or as examples for you to create your own.

History

  • Added by Avatar Reality
Problems with this wiki page? Contact us either by: Support Email or Support Ticket System

Blue Mars Guidebook Privacy Policy
Blue Mars Guidebook Community Guidelines

Personal tools