Download

Trying to do something complicated involving rising, disappearing/reappearing actors. Please help!

I made this image as a reference. So, the differently colored cones will spin continuously, every other cone switching direction of rotation. That I have already figured out. They need to appear out of the sphere at the bottom, rise up, disappear into the cube at the top, then reappear from the sphere again. There cannot be a large gap along the length of the shaft (made of cones) at any time during the loop. That includes at the top and bottom. I thought I’d just make them grow as they rise out of the sphere, shrink as they enter the cube, then move down to the sphere at twice the speed they rose. If it matters, this will be an item held by the player. Someone suggested InterpTo, but I don’t see a way to make them grow/shrink at the proper times, nor do I see a way to make them move faster once they change direction. Any suggestions?

Lol, yep that’s some complicated movement :slight_smile:

Well I guess the way I’d approach it, would first be to create a controller blueprint that will spawn the cones, handle movement, and act as a controller for the whole thing. I reckon each of the cones (or whatever mesh you replace them with) will have to be individual actors to allow them all to rotate and move back to the start point independently. The blueprint will also have to be given the start point (the sphere) and end point (the cube) world locations (as vector3), and a reference/pointer to the character holding it. It would then need to do a bit of maths to calculate the location of each cone along the path between the start and end points (actually probably a better way see bold below).

I can’t figure if you mean the cones will move from start to end point then disappear and reappear at the start, or when they get to the end point they then move at twice speed back to the start point again and repeat… Either way it would just be a matter of playing with the maths a bit.

If this column/totem of spinning cones is being held by a character, you’ll need to have a socket attached to the characters hand in their skeletal mesh. You will then have to pass a reference/pointer for the character holding the totem to the controller blueprint. Then you can use the “Get Socket Location/Rotation” blueprint nodes to get the world location and rotation of the character socket holding the totem.

Then in the controller blueprint on each event tick you would need to get the socket location and rotation for the totem start point (as the character will be moving). Also define a vector3 for the TotemLength (0,0,x) where x is the length of the totem from start to end point in ue4 units. Then use the “Rotate Vector” node (with input TotemLength and SocketRotation) and add the output result to SocketLocation. This should give you the totems endpoint world location.

Then I would create an array with one element for each cone in the totem. The array type i’d make a user defined struct that would include a pointer to the spawned cone object, a vector3 to store its world location, and a float to store it’s percentage distance “LocRatio” along the length of the totem (0= start point, 1 = end point). Then each event tick increment the cones LocRatio along the totem length by MvSpd (a value that represents movement speed) (as event tick triggers at approx frame rate if you wanted the cones to take ~2 secs to travel the length of the totem at 60 fps MvSpd = ~0.03). Then do similar maths as before to calculate each cones world location: Cone.SetWorldLocation = StartLocation + RotateVector (TotemLength*LocRatio, SocketRotation). You would also probably have to add the sockets rotation to each cones rotation so the cones would stay rotated relative to the character socket…

You might also find the “Find Look At Rotation” node useful. Then to tell if the cone has reached the end point just do a check to see if LocRatio >= 1, and either reset LocRatio to 0 or change MvSpd to -x. For scaling the cones you could just check its LocRatio value again and add a small scale multiplier… So if you want the smaller starting scale (StartScale = eg. 0.8 full size) and it to reach full scale at 20% along the start-end path then:

Initialise:
ScaleDiff = 1 - SmallStartScale (e.g. SmallStartScale = 0.8 full scale)
ScalingEndLoc = eg. 0.2 (reaches full scale 20% along totem)

Event Tick:
If LocRatio < ScalingEndLoc:
ScalePathDist = (ScalingEndLoc - LocRatio) * (1/ScalingEndLoc) (to give result between 0 (point that scale is full size) and 1 (cone at start point))
ConeObject.Scale (1 - (ScalePathDist * ScaleDiff) )

You’d also have to turn off collision for the cones…

There might be an easier way to do it… :slight_smile:

Thinking about it, you could probably make the totem an actor blueprint which you could then attach to the characters hand socket, then in the totem blueprint add a static mesh component to it for each moving cone, then you could simply use MeshComponent.SetRelativeLocationAndRotation for all of the cones using similar maths as above (except you wouldn’t need to include any of the SocketLocation and SocketRotation data as that would be handled automatically by the blueprint being attached to the socket…

You’d still need TotemLength, LocRatio, MvSpd, and the array for holding data for each cone though… Then just use MeshComponent.SetRelativeLocation**(TotemLength * LocRatio)…**