Skip to the main content.

Did you know?

 

RTI is the world’s largest DDS supplier and Connext is the most trusted software framework for critical systems.

Tiered-Support-Plan-DatasheetTiered Support Plans

Our Professional Services team brings extensive experience to train, problem-solve, mentor, and accelerate customer success.

Learn more

Developers

From downloads to Hello World, we've got you covered. Find all of the tutorials, documentation, peer conversations and inspiration you need to get started using Connext today.

Try the Connectivity Selection Tool ⇢

Resources

RTI provides a broad range of technical and high-level resources designed to assist in understanding industry applications, the RTI Connext product line and its underlying data-centric technology.

Company

RTI is the largest software framework company for autonomous systems. The company’s RTI Connext product enables intelligent architecture by sharing information in real time, making large applications work together as one.

News & Events
Cooperation

MODULE 6:
Gaming Visualizations: Publishing a Shape in 3 Dimensions

⇠ Back to All Modules

Case + Code

Introduction

This module builds directly on Module 5: Expanding to Multiple Topics. You will need to complete that module before performing this module. In this module we will be making changes to our topic, extending it to movement in 3 dimensions.

Step 1: Updating ShapeComms

Our classes need to be updated to allow for writing the data from our 3D shape.

  1. Within the project, add a new class to the ObjectDefs as follows:

    public class Shape3D : Shape
    {
        public int z;
    }

  2. Update all instances of Shape to Shape3D (except for the definition of the Shape class in ObjectDefs).
  3. We will need to add some code to some functions in order to utilize this functionality.
    1. In ShapeComms, add the following line to the SetShapeData function after the y SetValue call.

      data.SetValue("z", shape.z);

    2. In ShapeComms, add the following line to the ParseShapes function after the y assignment.

      z = (Int32)shape.Data.GetAnyValue("z"),

    3. In ShapeManager, in the MoveShape function, update the new Vector3 call to include shape.z:

      m_Shapes[shape.color].GetComponent<Rigidbody>().MovePosition(new Vector3(shape.x, shape.y, shape.z));

    4. In ShapeManager, in the AddInstance function, update the new Vector3 call to include shape.z:

      m_Shapes.Add(shape.color, Instantiate(m_ShapePrefab, new Vector3(shape.x, shape.y, shape.z), new Quaternion()));

Step 2: Test Against RTI Shapes Demo

Here we are using the RTI Shapes Demo shipped with RTI Connext to test our new application.

  1. Launch the RTI Shapes demo from the RTI Launcher.
  2. Publish to the Square, Triangle, and Circle topics in the RTI Shapes demo.
  3. Click OK to use the default settings.
  4. Run the Unity application. You should see shapes moving across the screen.

If a shape does not appear, check the debug log within Unity to see if there are any problems within your application. Common problems include a missing license or XML file, along with misspellings of references within the XML file.

Also make sure that you didn’t make any mistakes in the conversion process, for example not changing a Shape to a Shape3D.

Conclusion

From this application we have shown that the DDS part of a Unity application is rather straightforward. The key is to map the Data Model used for communication to Unity® objects. Once the mapping is figured out the Unity configuration and DDS code can be done relatively easily.

 

Module 6 Demo

This video covers the steps for Module 6.

 

 

Next Steps

Now that you have completed the Unity and Connext Case + Code tutorial, please visit the RTI Community to share your feedback, ask questions and show the world what you built with Unity and Connext.

The objects and scripts used within this project can be found here in GitHub.

This is only an introduction to this type of integration. You should also check out our Unreal Engine Case + Code, which works using the same data model and behavior as this tutorial. This provides a method for interoperation between the two platforms and the option for tailoring the appropriate game engine to different requirements and/or developer experience.

Visit our Modeling, Simulation & Training web page to learn more about using RTI Connext in simulation environments.