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

Function "setVehicleComponentRotation/Position” does not change the position and rotation of the collision model #3820

Open
1 task done
T-MaxWiese-T opened this issue Oct 21, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@T-MaxWiese-T
Copy link

T-MaxWiese-T commented Oct 21, 2024

Describe the bug

The function setVehicleComponentRotation and setVehicleComponentPosition does not change the position and rotation of the collision model. For example, changing the rotation of the fork of the forklift does not change the collision model rotation. This could lead to unwanted results.

Steps to reproduce

  1. Drive against a vehicle with the fork in a forklift.
  2. Execute this client code while sitting in a forklift:
function fork()
   setVehicleComponentRotation(getPedOccupiedVehicle(localPlayer), "misc_a", 0, 0, 180)
addCommandHandler("fork", fork)
  1. Hit the vehicle again with the fork. Although the fork rotation has changed, the rotation of the collision model has not changed.

Version

Client: v1.6-release-22763
Server: v1.6-release-22763

Additional context

I think the best solution would probably be to add an additional parameter to the setVehicleComponentRotation and setVehicleComponentPosition function that determines whether the vehicle component should have a collision or not so that the collision does not disturb if it is the case.
With the setVehicleAdjustableProperty function, on the other hand, the collision model also shifts.

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.
@T-MaxWiese-T T-MaxWiese-T added the bug Something isn't working label Oct 21, 2024
@T-MaxWiese-T T-MaxWiese-T changed the title Function "setVehicleComponentRotation” does not change the position and rotation of the collision model Function "setVehicleComponentRotation/Position” does not change the position and rotation of the collision model Oct 21, 2024
@tut001
Copy link
Member

tut001 commented Oct 22, 2024

setVehicleComponentPosition with collisions enabled could be useful if the collision spheres are actually configured with the correct collision component types (ie door, boot, special), but it doesn't really make sense to give setVehicleComponentRotation a collision on/off toggle if the sphere would just rotate around its pivot, unless it actually rotates around the vehicle pivot?

@T-MaxWiese-T
Copy link
Author

setVehicleComponentPosition with collisions enabled could be useful if the collision spheres are actually configured with the correct collision component types (ie door, boot, special), but it doesn't really make sense to give setVehicleComponentRotation a collision on/off toggle if the sphere would just rotate around its pivot, unless it actually rotates around the vehicle pivot?

Whereby, for example, car doors and trunks do not have a collision, i.e. a differentiation into types would probably not make sense here.
But the fire truck with ladder or the forklift with fork have a moving collision. You can see which models have a moving collision here:

bool CClientVehicle::HasMovingCollision()

Regarding the rotation of the collision model not making a difference, yes I thought of that too, but it does make a difference. So in my code example with the forklift and the fork with the 180 degree rotation around the Z axis, the rotation of the collision model probably wouldn't make a difference, but if you rotated it 45 degrees for example it would make a difference. In the case of the fire truck with the ladder there, the rotation of the collision model definitely makes a difference.
The GTA function CAutomobile::UpdateMovingCollision, which is responsible for moving the collision models, only accepts one parameter, namely the angle, but theoretically it would also be possible to completely change the position and rotation yourself.

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

2 participants