Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Invisible entity gets created and COLLIDES with other entities (like prop_physics) when a player enters a seat #456

Closed
Dave9031 opened this issue Feb 9, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@Dave9031
Copy link

Dave9031 commented Feb 9, 2025

Short Description
Hello, i have recently returned to gmod and i have noticed some weird collisions with seemingly nothing when i have ACF-3 installed and I enter a built vehicle and start driving.
It seems there is an invisible entity being created which falls to the ground and collides with other entities when a player enters a seat
(this does not seem to happen if the vehicle is for example controlled via wiremods remote control, but only when a player enters a seat)

Branch and Version
Newest - Git-master-b4254b4

How to Reproduce
It seems that all you need to reproduce this is any "ACF whitelisted" seat (hl2 seats, playerstart seats, race seats) - does not happen on jeeps, airboats
I found it easiest to reproduce by building a car and adding a prop as a plow infront of the seat
-- Please check the attached video --

However, even just a prop_physics with 400kg mass and a thruster with the seat welded infront of it works
--> Enter the seat, make the prop move (even just thrusters work) into the "spawned entity" (it seems to spawn and hang around below the seat, on the ground)
--> Collision sound can be heard

Video
I have attached a rather simplistic video demonstrating the issue, but i believe it shows everything that is needed
I have used a prop engine car with a friction gearbox, since the amount of props makes it easier to see the collisions
https://github.com/user-attachments/assets/2f98674c-164d-4bc9-a955-3a8d21754218
(I know the quality is not great since its compressed to fit githubs 10MiB limit)

(Im probably ovethinking by time stamping this ... oh well lol)
0:05 - I drive past the "entity" and it collides with the gearbox - collision noises can be heard
0:12 - This time I drive backwards - it collides with the "plow" infront - collision noises can be heard
0:15 - This time it collides even with the wheels - collision noises can be heard
0:31 - I test that going backwards if fine - "entity" should be infront
0:56 - Totally fine if the seat is out of the way - and therefore the "entity" is too
1:04 - Purposely drive into it - yep its there

Additional Information
I have quite barbarically searched for the root of the issue (by adding prints of course! :) ) and I hopefully narrowed it down to the "seat alias" system
#432 Might be related to this

ACF-3/lua/entities/acf_seat_alias/init.lua

hook.Add("PlayerEnteredVehicle", "ACF.CreateSeatAlias", function(Ply, Vic)
    if not IsValid(Ply) then return end
    if not IsValid(Vic) then return end

    print("Applying alias "..tostring(Ply).."/"..tostring(Vic)) -- heh
    ACF.ApplyAlias(Vic, Ply) -- When I barbarically comment this out the problem seems to go away
end)

I think the main issue could be here :

ACF-3/lua/entities/acf_seat_alias/init.lua

function MakeACF_SeatAlias(Vehicle) -- Called by ACF.ApplyAlias
...
  Ent:PhysicsInit(SOLID_VPHYSICS)
  Ent:SetMoveType(MOVETYPE_NONE)
  
  Ent:SetParent(Vehicle) -- This does not seem to work since the "entity" seems to hang around on the ground?
  Ent:SetPos(Vehicle:LocalToWorld(AliasInfo.Pos))
  Ent:SetAngles(Vehicle:LocalToWorldAngles(AliasInfo.Ang))
  Ent:Spawn()
  
  Ent:SetCollisionGroup(COLLISION_GROUP_NONE)
...
end
@Dave9031 Dave9031 added the bug Something isn't working label Feb 9, 2025
@OctothorpeObelus
Copy link

This is because the collision group is set to none, which is the normal collision group for all objects, not a collision group that means no collisions. It has yet to be fixed. You can patch it locally by changing the collision group to COLLISION_GROUP_WORLD which does not collide with players or physics entities.

Image

@thecraftianman
Copy link
Member

This will no longer be a problem due to the seat alias system as it stands now being removed in 6bada10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants