Split grenade collision from weapon collision
This most likely fixes #1123 Atleast I couldn't identify any other change that happens on first grenade throw.
Currently on the first grenade throw we add a colsphere into the colmodel of the grenade. But all weapon models have the same colmodel set. This PR splits grenades into their own colmodel and also adds the colsphere on game start.
I tested it and it splits the collision. But I can't say if this completely fixes #1123. This is however still an useful change because multiple people ran into the issue that weapons/projectiles have collision where they should not have any.
This most likely fixes #1123
Needs to be confirmed.
This is however still an useful change because multiple people ran into the issue that weapons/projectiles have collision where they should not have any.
Why not? Personally I use the fact that weapon objects have collisions in my gamemode. You can disable these via setElementCollisionsEnabled, which apparently doesn't work on weapon elements but it's different issue (#1365).
Weapon objects doesn't have any collisions after this change?
Weapon objects doesn't have any collisions after this change?
Weapons by default do not have any collisions. Only after the first grenade throw they have collision. I think it should be consistent and not change mid game when someone throws a grenade.
I think it should be consistent and not change mid game when someone throws a grenade.
I agree. We could initialize that collision then. In my gamemodes I always used to create projectile at the resource start to fix this. I just don't get why do you want to seperate it from other weapon models. I think it would be nice for weapon models to have collisions.
I think it would be nice for weapon models to have collisions.
Wouldn't more collisions cause more overhead? If there aren't any actual benefits from collisions there shouldn't be any. We should benchmark any difference since depending on the server there may be thousands of weapons in use at a time.
I think it would be nice for weapon models to have collisions.
Wouldn't more collisions cause more overhead? If there aren't any actual benefits from collisions there shouldn't be any. We should benchmark any difference since depending on the server there may be thousands of weapons in use at a time.
I don't think it affects weapons carried by players.
Player held weapon don't have collisions, so why should custom weapons have them? In any case, you can always attach an invisible object with a collision to a custom weapon if you need them, it'd be still a less hacky solution than relying on current blatantly erroneous behavior.
Player held weapons/custom created weapons shouldn't have collisions - at least not by default. If it would be added, it should be toggleable via function, and not being enforced.
Player held weapon don't have collisions, so why should custom weapons have them?
But that change affect objects too.
We could fix #1365 and then make custom created weapons collisionless by default.
So, in summary, my proposal is:
- initialize that collision
- add custom created weapons support to
setElementCollisionsEnabled(fix #1365) - make custom created weapons collisionless by default
I agree that setElementCollisionEnabled should work for custom weapons. But I don't think making custom weapons collisionless by default is the right choice. When I replace the collision of a weapon model I expect the collision be there by default for custom weapons.
If anyone needs the grenade collision on weapon objects they can always just add a collision to that weapon model. It's just a col sphere with center = {0.0, 0.0, 0.0} and radius = 0.1875
Thinking about it now, making custom created weapons collisionless by default would break backward compatibility because it's actually possible to create weapon with model different than weapon model (it's possible to use setElementModel on weapon elements). Also it's possible to replace weapon model as you said.
I don't like the idea of making weapon models collisionless though. Maybe we could initialize small box collison for weapon models. But that would kinda break backward compatibility too.