Hologram Animation

The sun and planet holograms in the Starter Game seem to be animated through a combination of texture oscillation and Flow Graph nodes. I was able to reproduce the texture oscillation no problem; however, when I try to recreate the HologramEffects flow graph on a smaller scale, the Movement:RotateEntity seems to do nothing. Since I can’t select the hologram in the Starter Game, I don’t know if there are additional scripts on the hologram entities that make everything functional.

Hey @Taylor, great question - let me see if I can find some answers for you :slight_smile:

I finally saw the Layers tab of the Roll up Bar which allowed me to make the hologram geometry selectable and I didn’t see any scripts on it so I assume all object animation was done using the flow graph.

Hey @Taylor,

I posted an answer to your question, which you can jump to using this link.

You
are correct in that you can use the Layers tab in the RollupBar to make
the hologram geometry selectable. For clarification on attached scripts, Legacy Entities are backed by a Lua script which is different from the Lua script components that can be attached to Component Entities. You can see the Lua script associated with one of the holograms by selecting it and within the Create tab of the RollupBar open up the “Entity: GeomEntity” tab. For what controls the objects animation, it’s rotational motion is due to the HologramEffects flow graph.

If you’d like more information on Lua scripting with Component Entities take a look at the documentation at this link.

Please let us know if you have any further questions.

Hi @Taylor,

Thanks
for your question regarding the Movement:RotateEntity flow graph node. As we are moving away from Flow Graph to a new visual scripting system I’d like to show you how we can use Lua scripting to achieve the same effect. However if you’d still like to continue using Flow Graph know that we’ll support you.

I took a look at Starter Game and the HologramEffects flow graph associated with the planet and moons hologram
near the start of the level. We can achieve the effect that RotateEntity provides using Lua scripting, the EBus system and Component
Entities.

There’s two ways of approaching this. Either directly manipulating the transform or use physics so the object can interact with physical objects. In the example I created I chose the physics route because it involves less math and allows us to focus on the desired outcome without additional complexity.

Here’s a list of the components involved to allow the script to function.

  • Rigid Body Physics component
  • Primitive Collider component which requires a Shape
  • Box Shape component
  • Lua Script component
    The
    below script when attached to this object will allow you to edit its AngularVelocity in a similar way to the RotateEntity node.
	-- Conversion scalar to convert from degrees to radians
local toRadians = math.pi / 180
local RotateEntity = {
-- Properties listed here will be exposed to the editor
Properties = {
-- Our angular velocity or how much we rotate on each axis (x, y, z) each second
Velocity = { default = Vector3(0,0,0), desctription = "Angular Velocity", suffix = " degrees/sec" },
},
VelocityRadians = Vector3(0),
}
function RotateEntity:OnActivate()
--Connect to the tickbus to enable our update function OnTick
self.tickBusHandler = TickBus.Connect(self, 0)
-- Convert our Velocity to radians to correctly pass it through the EBus
self.VelocityRadians = self.Properties.Velocity * toRadians
end
function RotateEntity:OnDeactivate()
-- Disconnect from tickbus as part of our cleanup when we deactivate
if self.tickBusHandler ~= nil then
self.tickBusHandler :Disconnect()
self.tickBusHandler = nil
end
end
function RotateEntity:OnTick(deltaTime, timePoint)
-- Call the SetAngularVelocity Event bus, we pass it the entity Id of the object we want to affect (self), and the velocity we want to enact on the entity
-- Convert our velocity from degrees/second to radians/second
PhysicsComponentRequestBus.Event.SetAngularVelocity(self.entityId, self.VelocityRadians)
end
return RotateEntity

Please let us know if you have further questions.

Hey @Taylor,

I did notice you referenced the sun and planet holograms in your initial post while my answer is focusing on the planet and moons holograms in Starter Game. Please let me know if there is another example I’m not referencing so we can be on the same page. I want to make sure we’re looking at the same holograms :slight_smile:

Hey @Scott_LY,

I was originally looking into both the planets and the moons holograms. I discovered some where animated through texture, and it was the ones animated through the Flow Graph that I was curious about. Thanks for writing out that script and it’s breakdown. I’ll look into incorporating it. Also, I eagerly look forward to the new visual scripting system.

Hey @Taylor,

No problem, let us know if you have any further questions or need help with the script.