Page 1 of 1

Object doesn't collide when it's small

Posted: Thu Jul 13, 2017 10:54 am
by fury22uk
Hi. I am facing some problem with collision.
I am testing it on First Person Shooter template with original models etc.
As you know, in Crytek's code weapon spawns bullet (primitive_sphere.cgf sized to 0.05f of a normal size) and it collides with everything. When I spawn another human entity and I try to shoot it, the bullet goes through it without logging the collision. I figured out, that if bullet is bigger than this (instead of 0.05f for example 0.3f) it collides perfectly. Both are physicalized. Human is PE_LIVING and bullet is PE_RIGID, but there must be something more to it. Why does it ignore collision with tiny objects? Mass of bullet is set to 160 and human 90.

Re: Object doesn't collide when it's small

Posted: Thu Jul 13, 2017 12:25 pm
by mknmknmknjk
do you scale the object? proxy scale with Model?
try console command p_draw_helpers 1 to see if proxy is scaled properly.
http://docs.cryengine.com/display/SDKDOC2/Physics

these are theory
http://docs.cryengine.com/display/CEPROG/CryPhysics
watch resulting in entities "losing collisions" .
may be some issue.

https://www.cryengine.com/community_arc ... 6&t=102493

Re: Object doesn't collide when it's small

Posted: Fri Jul 14, 2017 12:49 pm
by fury22uk
I do scale the object. I checked that cvar. The proxy is scales along with the object, so I have no idea what's going on. It only avoids collision with PE_LIVING entities (I did not set up any filtering). If I shoot it against some simple cube etc. it collides with it. But with living entities it collides only when it's not scaled down so much.

EDIT:
Well I actualy changed the whole physics type.. Instead of this :

Code: Select all

SEntityPhysicalizeParams physParams; physParams.type = PE_RIGID; physParams.mass = fMass; physParams.pPlayerDynamics = &dynams; GetEntity()->Physicalize(physParams);
I used PE_PARTICLE and not only I got collision for that bullet system, but also the "heading" property seems to fit the bullet concept way better than impulse or velocity action. Now my current code :

Code: Select all

pe_params_particle partParams; partParams.flags = particle_traceable | particle_no_roll | pef_log_collisions; partParams.mass = 0; partParams.size = 0.1f; partParams.thickness = 0.1f; partParams.gravity = Vec3(0, 0, 0); partParams.kAirResistance = 0.0f; partParams.surface_idx = 0; partParams.velocity = 100.0f; partParams.heading = direction; SEntityPhysicalizeParams params; params.pParticle = &partParams; params.type = PE_PARTICLE; GetEntity()->Physicalize(params);
Awesome! Thank you for help anyway, I checked your links and I've learned a couple of useful cvars.