Need help placing container on ground properly

Hi, I’m trying to create a container mission where the user of the script has to saw open a container. The problem is that when I want to place another container inside the red container it won’t work because the game think theres still an entity right there which technically is but the collisions are off…

Heres a picture of what I mean and then I’ll explain more detailed.

Player opening the container, that’s part of a synchronized scene:


This is where my problem happens. I turned the collisions of the red container off so the player can walk in it and then create a white (But normally invicible) container so it looks like the player walks into the red container.

Now I need help to place the object on the ground as properly as I used with the red container. I placed the red container on the ground with PlaceObjectOnGroundProperly but that doesn’t seem to work with the white container as I mentioned before because the game thinks theres an entity right there which technically is but the collisions are off…

Is there someone that can help me?

Thought I fixed it but I didn’t, when I spawn a container on another location it doesn’t work which is logic because not everywhere the z coords are the same :(((

Anyone any idea?

1 Like

When you used PlaceObjectOnGroundProperly where you near the object? I have had issues in the past when using it on vehicles when they are spawned far away. It only worked when I was in the area of the object.

No, I’m testing it on the other side of the map so I’m sure it works but it doesn’t… I think it has to do something with the distance, it works when I restart the script after a couple of times. I think I’m going to create the entity when the player is in distance of 100 because then I hope it works…

In OneSync, the maximum distance for entities or objects is set at 424 units. If something is beyond this distance, it falls outside the player’s focus zone, and OneSync will cull it. This implies that attempting to place an object on the ground using PlaceObjectOnGroundProperly might not work if the object is outside this zone, as it hasn’t been rendered yet. I guess you can create the object when the player is within the 424-unit range. Or if the object is created beforehand, you could continuously check the player’s distance. Once the player is close enough, you could then use PlaceObjectOnGroundProperly on the object. This should work but I guess you never know until you try it.

Bruh how is this possible, I’m just trying sometimes without even touching the code and still sometimes my white container won’t spawn on the right Z coord. How is that possible, the white container only gets created when I’m already at the red container…

I guess you could get the z cords of the player at that moment and set the z cords of the container to that? If its slightly too high or low you could create an offset so that it takes the players z cords and reduces or increases it by x to set it properly.

Okay I did this and that works the only weird part right now is that sometimes when I enter the range of 300 the container gets not placed on the ground properly, has that something to do with PlaceObjectOnGroundProperly?

Maybe the distance of PlaceObjectOnGroundProperly can not be higher then 100 or something?

what is the entity name and ill test it out and let you know.

Well , if I understand u correctly at every need of your script u have red container first?
White one u spawn if u are entering red correct?
Why not use red container coords?
i would get red container entity and transfer it’s exact coordinates to white one? wouldnt that be an answer to your problem or I did’nt understand something ?

This is the entity of the red container: tr_prop_tr_container_01a

Thi is the model of the white container: prop_ld_container

Yea I’ve tried that before but didn’t really work out well. I will try your solution again in the afternoon, thanks for your input!

Hey man, do you maybe have any idea on how to fix this? I’ve already created a function that checks the player his distance and when the player is in range of 300 the container should be created but on some locations the container won’t place properly on the ground, kinda weird do you know why?

Instead of checking the distance try checking if the entity exists. I tried it on my test server and I was working fine the container was always on the ground properly. The only difference was I was checking if the entity existed and I wasn’t trying to place it inside another container.