(SOLVED) Spawned actor behaves differently from Actor Placed

Hello!

I have an Actor (character) that replicates. (Actor, Capsule and Mesh all replicate)
When setting its skeletal mesh component I also add a local offset to it in order to place it in the middle of the Capsule. → I do this both in Construct and Begin Play.

I set actor location to move it around in the map. (the location replicates correctly)

So the problem is that when I place it in the map manually, everything works just fine.
But when I SPAWN the actor on clients, if I apply a Set Actor Location the local offset on the Skeletal mesh is gone.

Why is that?

Note: this bp is a child of another BP. The offset happens in the parent. Although, I tested and even if I set the offset in the child, the problem remains.


This is how I reposition the skeletal mesh on Construct and Begin Play.


This is how I spawn the actor in game

It happens also with the simplified version…

t
Game Start


Actor Placed in world manually moving correctly


Actor spawned loses offset on Clients when Setting Actor Location.

This happens whether I set actor location in client, server or even in the actor blueprint itself!

Please help.
If you need further information, please let me know. :slight_smile:

Here is something, i have just learned about this engine. When you use the Constructor and use
SetRelativeRotation(FRotator(0.0f, 0.0f, -90.0f); or whatever rotation you use, it will go in fine right where you asked it to. Once in game and you want to change his position or the object position. The yaw and the roll in rotation swap.

Here is what i mean i set my object to spawn rotation at FRotator(0.0f, 0.0f, -90.0f); Relative to the main object. Then once in game i go to move that item and it disappears or is in wrong position. To fix it i had to do this, when resetting it to get it back to its main starting position, FRotator(0.0f, -90.0f, 0.0f); then it would work right.

Also if you are getting world coordinates for relative or vise versa this will cause that also.

Hi! Thank you!
Yeah that’s true. I have been careful to work in relative space - only - for the component.

I just don’t understand why spawning the actor makes it behave differently from one you would place in the scene manually. Seems strange. Also in the Server everything works just fine. It’s only in the clients that the offset gets reset.

yeah i am trying to get dice to move around on a table and it has been nothing but a pain in the ■■■. I am having same issues as you are. go to move it and they disappear, go to next move they appear, then move again they spawn shoot straight up hit roof then fall to table. Bunch of crazy stuff going on like physics is just broken!

If it only on the clients that it getting reset. Check client functions for it being reset, You should find it in one of them.

If you are using physics, try to check the Teleport checkbox in the Set Actor Location.
Also Check the Collision Settings. If the dice have a collison mesh, make sure only that one has collisions. I would turn off collision on the die component itself.

Also if you are trying to interact with the die, look into the Physics Handle Component

That could help.

Let me know if that works :slight_smile:

thanks will look into that.
Yes i am interacting with the dice. Been trying to attach them to my pawns hands fingers via sockets i added, they disappear, but i can invisible throw them and get my result to test further thru the code. Yes my attaching of the dice does not seem to put them into my hands fingers like it should. I also notice when i move them to a sockets location i get wrong coordinates from the GetSocketLocation();

LogCrapsTable: ACQ_CrapsTable::MoveDiceToShooter() ShootersDiceSocket = Player_0_DiceStart
LogCrapsTable: ACQ_CrapsTable::MoveDiceToShooter() LDelta.X = -1557.000000
LogCrapsTable: ACQ_CrapsTable::MoveDiceToShooter() LDelta.Y = 338.000000
LogCrapsTable: ACQ_CrapsTable::MoveDiceToShooter() LDelta.Z = 165.000000

Seems those above must be world coordinates.
and it needs it to be relative.

//edited to match the sockets actual relative fvector
LogCrapsTable: ACQ_CrapsTable::MoveDiceToShooter() LDelta.X = 195.000000
LogCrapsTable: ACQ_CrapsTable::MoveDiceToShooter() LDelta.Y = 255.000000
LogCrapsTable: ACQ_CrapsTable::MoveDiceToShooter() LDelta.Z = 0.000000

Check this section.
Could be of help to you :slight_smile:

1 Like

(SOLVED)
Some Google FU brought me to this post that had the same problem

This answer solved it for me:

I came across the same problem. We have characters that changes form including the size of the capsule which meant changing the relative location of the mesh so its flush with the capsule. In a network game the set relative location doesn’t work even if called on all clients. The reason being is the character movement component keeps a record of the relative location at the beginning and reuses the value when doing movement smoothing. We solved the issue by rerecording of the relative location when we change it through code. If you don’t have access to code then there are 2 other solutions. 1. if the relative location is constant then you can call set relative location every tick. or 2. Set the Network Smoothing mode to Disabled which can be found in the character movement component in the blueprint. Hope that helps!

Apparently the problem is that the replicated character movement ignores any update to the Set Relative Location on the mesh for Client.

Just add it in to replication just as if you were writing your own replication for a var or a FVector. Then you will have it working like you need. Thanks for that info, i will need to add that soon.

1 Like