You can set up an interface in a Simulink® block diagram to sensors in a virtual reality scene. You can also input signals programmatically from the virtual world into a simulation model.
Virtual reality scenes can contain sensors, which are nodes that generate events and output values depending on time, navigation, and actions and distance changes in the scene. These nodes add interactivity to the virtual world. The virtual world sensors resemble real world sensors, such as ultrasonic, LIDAR, and touch sensors. You can use Simulink 3D Animation™ functions to read sensor field values into simulation models and control simulation based on the user interaction with the virtual scene.
You can use collision detection to accurately model physical constraints of objects in the real world, where generally two objects cannot be in the same place at the same time. You can use collision detection node outputs to:
Change the state of other virtual world nodes.
Apply MATLAB® algorithms to collision data.
Drive Simulink models.
For example, you can use geometric sensors for robotics modeling.
You can define these sensors in the scene.
|Maps pointer motion (for example, a mouse) into a rotation on an invisible cylinder that is aligned with the y-axis of the local coordinate system|
|Maps pointing device motion into two-dimensional translation in a plane parallel to the z=0 plane of the local coordinate system.|
|Generates events when the viewer enters, exits, and moves within a region in space (defined by a box)|
|Maps pointing device motion into spherical rotation about the origin of the local coordinate system|
|Generates events as time passes|
|Tracks the location and state of the pointing device and detects when you point at geometry contained by the TouchSensor node parent group.|
|Detects visibility changes of a rectangular box as you navigate the world.|
|Uses point clouds to detect which of the points are inside colliding geometries|
|Uses ray fans or other sets of lines that detect the distance to the colliding geometries|
|Primitive geometries (such as a cone, sphere, or box) that detect colliding geometries|