Download

Creating a math-based series of objects?

Hello everyone, sorry I am a really big noob but I am wanting to start working on a VR thing, where basically I have objects that have number attributes (e.g. Weight: Float = 90.0, etc.), and lets say if I connect two of these objects together (by like a rope or something), have a variable that holds the combined weight of the two objects connected, and be able to do math functions (e.g. Combined weight = 180.0, weight on moon would be = 29.76, based off of ((weight/9.81)*1.622)).

Is this possible?

Thank you!!!

So… You want to keep track of attributes that different object classes can hold. Let’s say a box, a spoon, a car, a boulder, and a animal, correct?

And then… Perform math operations on the different objects while accessing these attributes, yes?

Sounds like an object/message oriented programming approach. Look into OOP methodology since Unreal allows object or class based approaches if your not familiar with them already.

Keeping track of attributes that different object have can br done with a structure. Each object could have this structure stored in it - it could be a custom made component blueprint that holds it. This way you can ask if the object in question has this component.

Likewise, the component could also perform the math operations, this depends on your needs, since it works with the attributes in question. Several alternatives:

  1. Macro - define your macro functions in a library, accessible by any other actor
  2. Blueprint Interfaces - these pass information between objects, they don’t let you perform functions though. This is one of three methods of blueprint communication.
  3. Singleton - where you always have an object in the level/application that can be accessed to perform your functions.

Some of the other pros here may have other solutions.