Skip to content

raisim::ProjectileProperties ​

struct · #include <raisim/Explosion.hpp>

A ballistic projectile: a shell, a bullet, a rocket after burnout. It flies through the world's fluids: drag acts on its velocity relative to the fluid around it, so the wind (the velocity of the ambient fluid, World::setAmbientFluid()) carries it and its density sets how hard the air holds it back; in a volume of liquid (World::addFluidVolume(), below its mean surface) the liquid's density and current do. A world without an ambient fluid is a vacuum. An explosive projectile (explosion.chargeMass > 0) detonates where it hits or when its fuse runs out; an inert one stops where it hits. Either hands its momentum to a dynamic body it hits.

Public attributes ​

mass ​

cpp
double mass

Mass (kg).

radius ​

cpp
double radius

Radius (m) of its cross section, which sets its drag area.

dragCoefficient ​

cpp
double dragCoefficient

Drag coefficient of its cross section (about 0.3 for a shell at subsonic speed).

maxLifetime ​

cpp
double maxLifetime

Seconds after launch at which the projectile is removed if it has hit nothing.

fuseTime ​

cpp
double fuseTime

Seconds after launch at which it detonates in flight; zero or negative: no time fuse.

detonateOnImpact ​

cpp
bool detonateOnImpact

An explosive projectile detonates where it hits something; otherwise it stops there. Either way it hands what it hits the momentum an inelastic impact transfers: the projectile's velocity times the reduced mass of the projectile and the body it hits.

explosion ​

cpp
ExplosionProperties explosion

The explosion it sets off; a chargeMass of zero makes an inert projectile.

collisionMask ​

cpp
CollisionGroup collisionMask

Collision groups the projectile hits.

ignoredObject ​

cpp
size_t ignoredObject

World index (Object::getIndexInWorld()) of an object it passes through, such as the vehicle that fired it; size_t(-1) for none.

RaiSim — physics for robotics and AI.