Closed TenshiTachibana closed 2 years ago
This is probably because you're spawning them on a displacement, but even if they still fall thru that's a vphysics issue which is not easily fixable aside from potentially changing the entity's collision group.
I don't know what a displacement is.
Do I just leave it alone for now?
They spawn perfectly fine on displacements, and not on flat surfaces. I just tried it out.
When the sandbox spawn menu spawns a new engine entity like Half-Life 2 ammo, it performs a trace from the player's eye position towards where they're looking. From this, it finds two values: the hit position and the hit normal of the trace. The hit position describes the three dimensional coordinates where the trace intersected with the world. The hit normal describes the angle of the surface that the trace hit.
The code multiplies the hit normal by 16 units and adds this to the hit position to produce a three dimensional coordinate where it should place the new entity. If the entity being spawned has an offset value (many HL2 entities have an offset value of 32), then it will again adjust the new entity position to be however that many offset value units away from the surface. If you spawn an AR2 orb on a flat surface, it will be positioned a total of 48 Hammer units above the surface. Then, it will spawn the orb and call DropToFloor(), which is an engine function that will perform another trace starting from the entity position and aims directly down. The closest surface that the engine finds will be the surface that the entity is placed onto.
The reason they fall beneath the surface in your video after spawning the first one is because the trace is no longer hitting the world surface, but instead the first orb that you spawned. The collision model of the AR2 orb places the crosshair over the bottom of the model, which has an angle that interferes with this position calculation. This can place the new entity as much as 48 Hammer units below the surface. Sometimes it only places it a few units below the surface, where it catches the top of the geometry just beneath the displacement terrain.
The problem is not only for AR2 orb, but it can happen on any entity. It happens often with the AR2 orb because of the collision model.
Similarly, if you aim at the window ledge by spawn, it will spawn the entity 48 units up and then move it down to closest surface, which is on the geometry above the window.
I made a fix for this, which will try to prevent the entity from being placed below the world if the player is aiming at an entity. It also fixes the window problem, so entities may be spawned correctly in smaller spaces.
Hi,
I've been playing GMOD for a month or two by now — I have just recently found a problem I encountered last week. Whenever I repeatedly spawn an item; for example, an AR2 Orb, only one remains on where I spawn it and the rest falls underground or gets stuck underground. Same goes with other spawn entities on Half-Life 2, but that only happens on rare occasions; mostly the AR2 Orbs are affected. It would be greatly appreciated if this issue is resolved.
Game is ran with -noaddons, not loading legacy/folder addons! Initializing Awesomium.. Parent cvar in server.dll not allowed (p2p_enabled) No Kinect SDK (This is from pressing SHIFT+ESC and shown on the console command.)
Here is a link I recorded. https://youtu.be/JgaOYg8y1BU