[DEV] update the Z axis
This commit is contained in:
parent
1df51c29bd
commit
c6d911ce70
@ -56,14 +56,14 @@ def out_point3_y_up( v ):
|
||||
def out_scale3_y_up( s ):
|
||||
return "%g %g %g" % ( s.x, s.z, s.y )
|
||||
def out_quaternion_y_up( q ):
|
||||
return "%g %g %g %g" % ( q.w, q.x, q.z, -q.y )
|
||||
return "%g %g %g %g" % ( q.x, q.z, -q.y, q.w )
|
||||
# This implementation maintains blender's Z-up coordinate system.
|
||||
def out_point3_z_up( v ):
|
||||
return "%g %g %g" % ( v.x, v.y, v.z )
|
||||
def out_scale3_z_up( s ):
|
||||
return "%g %g %g" % ( s.x, s.y, s.z )
|
||||
def out_quaternion_z_up( q ):
|
||||
return "%g %g %g %g" % ( q.w, q.x, q.y, q.z )
|
||||
return "%g %g %g %g" % ( q.x, q.y, q.z, q.w )
|
||||
|
||||
|
||||
def get_physics_shape(obj, mainObjScale, use_y_up=False):
|
||||
@ -93,18 +93,18 @@ def get_physics_shape(obj, mainObjScale, use_y_up=False):
|
||||
# CONE
|
||||
elif name.startswith('cone'):
|
||||
shape = "Cone"
|
||||
props["radius"] = obj.scale.x
|
||||
props["height"] = obj.scale.z * 2.0
|
||||
props["radius"] = (obj.scale.x + obj.scale.y)*0.5
|
||||
props["size"] = obj.scale.z * 2.0
|
||||
# CYLINDER
|
||||
elif name.startswith('cyl'):
|
||||
shape = "Cylinder"
|
||||
props["radius"] = (obj.scale.x+ obj.scale.y)*0.5
|
||||
props["height"] = obj.scale.z
|
||||
props["radius"] = (obj.scale.x + obj.scale.y)*0.5
|
||||
props["size"] = obj.scale.z
|
||||
# CAPSULE
|
||||
elif name.startswith('cap'):
|
||||
shape = "Capsule"
|
||||
props["radius"] = obj.scale.x
|
||||
props["height"] = obj.scale.z
|
||||
props["radius"] = (obj.scale.x + obj.scale.y)*0.5
|
||||
props["size"] = obj.scale.z
|
||||
# CONVEX-HULL
|
||||
elif name.startswith('convex'):
|
||||
shape = "ConvexHull"
|
||||
@ -119,16 +119,21 @@ def get_physics_shape(obj, mainObjScale, use_y_up=False):
|
||||
|
||||
print(" shape type: '" + str(shape) + "' from element name:'" + str(obj.name) + "'")
|
||||
|
||||
if obj.location != Vector((0,0,0)):
|
||||
props["origin"] = out_point3(obj.location)
|
||||
if obj.matrix_world.to_translation() != Vector((0,0,0)):
|
||||
props["origin"] = out_point3(obj.matrix_world.to_translation())
|
||||
|
||||
if obj.rotation_mode == 'QUATERNION':
|
||||
qrot = obj.rotation_quaternion
|
||||
else:
|
||||
qrot = obj.matrix_local.to_quaternion()
|
||||
|
||||
print(" Origin (local ): " + str(obj.location))
|
||||
print(" Origin (global): " + str(obj.matrix_world.to_translation()))
|
||||
print(" Quaternion (local ): " + str(qrot))
|
||||
print(" Quaternion (global): " + str(obj.matrix_world.to_quaternion()))
|
||||
|
||||
if qrot != Quaternion((1,0,0,0)):
|
||||
props["rotate"] = out_quaternion(qrot)
|
||||
props["rotate"] = out_quaternion(obj.matrix_world.to_quaternion())
|
||||
|
||||
return (shape, props)
|
||||
|
||||
|
@ -118,6 +118,8 @@ void ege::physics::Component::generate() {
|
||||
it->getQuaternion().y(),
|
||||
it->getQuaternion().z(),
|
||||
it->getQuaternion().w());
|
||||
// The ephysic use Y as UP ==> ege use Z as UP
|
||||
//orientation = orientation * rp3d::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||
rp3d::Transform transform(position, orientation);
|
||||
rp3d::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
|
||||
proxyShape->setUserData(this);
|
||||
@ -140,6 +142,8 @@ void ege::physics::Component::generate() {
|
||||
it->getQuaternion().y(),
|
||||
it->getQuaternion().z(),
|
||||
it->getQuaternion().w());
|
||||
// The ephysic use Y as UP ==> ege use Z as UP
|
||||
orientation = orientation * rp3d::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||
rp3d::Transform transform(position, orientation);
|
||||
rp3d::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
|
||||
proxyShape->setUserData(this);
|
||||
@ -162,6 +166,8 @@ void ege::physics::Component::generate() {
|
||||
it->getQuaternion().y(),
|
||||
it->getQuaternion().z(),
|
||||
it->getQuaternion().w());
|
||||
// The ephysic use Y as UP ==> ege use Z as UP
|
||||
orientation = orientation * rp3d::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||
rp3d::Transform transform(position, orientation);
|
||||
rp3d::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
|
||||
proxyShape->setUserData(this);
|
||||
@ -184,6 +190,8 @@ void ege::physics::Component::generate() {
|
||||
it->getQuaternion().y(),
|
||||
it->getQuaternion().z(),
|
||||
it->getQuaternion().w());
|
||||
// The ephysic use Y as UP ==> ege use Z as UP
|
||||
orientation = orientation * rp3d::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||
rp3d::Transform transform(position, orientation);
|
||||
rp3d::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
|
||||
proxyShape->setUserData(this);
|
||||
@ -206,6 +214,8 @@ void ege::physics::Component::generate() {
|
||||
it->getQuaternion().y(),
|
||||
it->getQuaternion().z(),
|
||||
it->getQuaternion().w());
|
||||
// The ephysic use Y as UP ==> ege use Z as UP
|
||||
orientation = orientation * rp3d::Quaternion(-0.707107, 0, 0, 0.707107);
|
||||
rp3d::Transform transform(position, orientation);
|
||||
rp3d::ProxyShape* proxyShape = m_rigidBody->addCollisionShape(shape, transform, it->getMass());
|
||||
proxyShape->setUserData(this);
|
||||
|
@ -26,71 +26,71 @@ ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCapsule(float
|
||||
float offset = _size*0.5f;
|
||||
for(int32_t iii=_lats/2+1; iii<=_lats; ++iii) {
|
||||
float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
|
||||
float y0 = _radius*sin(lat0);
|
||||
float yr0 = _radius*cos(lat0);
|
||||
float z0 = _radius*sin(lat0);
|
||||
float zr0 = _radius*cos(lat0);
|
||||
|
||||
float lat1 = M_PI * (-0.5f + float(iii) / _lats);
|
||||
float y1 = _radius*sin(lat1);
|
||||
float yr1 = _radius*cos(lat1);
|
||||
float z1 = _radius*sin(lat1);
|
||||
float zr1 = _radius*cos(lat1);
|
||||
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
float x = cos(lng);
|
||||
float z = sin(lng);
|
||||
vec3 v1 = vec3(x * yr1, y1+offset, z * yr1);
|
||||
vec3 v4 = vec3(x * yr0, y0+offset, z * yr0);
|
||||
float y = sin(lng);
|
||||
vec3 v1 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v4 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
|
||||
lng = 2 * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng);
|
||||
z = sin(lng);
|
||||
vec3 v2 = vec3(x * yr1, y1+offset, z * yr1);
|
||||
vec3 v3 = vec3(x * yr0, y0+offset, z * yr0);
|
||||
out->addQuad(_materialName, v1, v2, v3, v4, _color);
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
out->addQuad(_materialName, v2, v1, v4, v3, _color);
|
||||
}
|
||||
}
|
||||
// Cylinder
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
|
||||
float y = _size*0.5f;
|
||||
float z = _size*0.5f;
|
||||
|
||||
float x = cos(lng)*_radius;
|
||||
float z = sin(lng)*_radius;
|
||||
float y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, z);
|
||||
vec3 v2b = vec3(x, -y, z);
|
||||
vec3 v2b = vec3(x, y, -z);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
z = sin(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
vec3 v3b = vec3(x, -y, z);
|
||||
vec3 v3b = vec3(x, y, -z);
|
||||
|
||||
out->addQuad(_materialName, v2, v3, v3b, v2b, _color);
|
||||
out->addQuad(_materialName, v3, v2, v2b, v3b, _color);
|
||||
}
|
||||
// center to border (BUTTOM)
|
||||
offset = -_size*0.5f;
|
||||
for(int32_t iii=0; iii<=_lats/2; ++iii) {
|
||||
float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
|
||||
float y0 = _radius*sin(lat0);
|
||||
float yr0 = _radius*cos(lat0);
|
||||
float z0 = _radius*sin(lat0);
|
||||
float zr0 = _radius*cos(lat0);
|
||||
|
||||
float lat1 = M_PI * (-0.5f + float(iii) / _lats);
|
||||
float y1 = _radius*sin(lat1);
|
||||
float yr1 = _radius*cos(lat1);
|
||||
float z1 = _radius*sin(lat1);
|
||||
float zr1 = _radius*cos(lat1);
|
||||
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
float x = cos(lng);
|
||||
float z = sin(lng);
|
||||
vec3 v1 = vec3(x * yr1, y1+offset, z * yr1);
|
||||
vec3 v4 = vec3(x * yr0, y0+offset, z * yr0);
|
||||
float y = sin(lng);
|
||||
vec3 v1 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v4 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
|
||||
lng = 2 * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng);
|
||||
z = sin(lng);
|
||||
vec3 v2 = vec3(x * yr1, y1+offset, z * yr1);
|
||||
vec3 v3 = vec3(x * yr0, y0+offset, z * yr0);
|
||||
out->addQuad(_materialName, v1, v2, v3, v4, _color);
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
out->addQuad(_materialName, v2, v1, v4, v3, _color);
|
||||
}
|
||||
}
|
||||
out->setNormalMode(ege::resource::Mesh::normalMode::face);
|
||||
|
@ -25,32 +25,32 @@ ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCone(float _r
|
||||
// center to border (TOP)
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
vec3 v1 = vec3(0.0f, -_size/2, 0.0f);
|
||||
vec3 v1 = vec3(0.0f, 0.0f, _size/2);
|
||||
|
||||
float x = cos(lng)*_radius;
|
||||
float z = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, _size/2, z);
|
||||
float y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, -_size/2);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
z = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, _size/2, z);
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, -_size/2);
|
||||
out->addTriangle(_materialName, v1, v2, v3, _color);
|
||||
}
|
||||
// center to border (BUTTOM)
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
|
||||
vec3 v1 = vec3(0.0f, _size/2, 0.0f);
|
||||
vec3 v1 = vec3(0.0f, 0.0f, -_size/2);
|
||||
|
||||
float x = cos(lng)*_radius;
|
||||
float z = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, _size/2, z);
|
||||
float y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, -_size/2);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
z = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, _size/2, z);
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, -_size/2);
|
||||
out->addTriangle(_materialName, v1, v3, v2, _color);
|
||||
}
|
||||
out->setNormalMode(ege::resource::Mesh::normalMode::face);
|
||||
|
@ -26,12 +26,12 @@ ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCube(const ve
|
||||
|
||||
out->addFaceIndexing(_materialName);
|
||||
|
||||
out->addQuad(_materialName, vec3(-1,-1,-1)*_size, vec3(-1, 1,-1)*_size, vec3( 1, 1,-1)*_size, vec3( 1,-1,-1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3(-1, 1, 1)*_size, vec3(-1,-1, 1)*_size, vec3( 1,-1, 1)*_size, vec3( 1, 1, 1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3(-1,-1,-1)*_size, vec3(-1,-1, 1)*_size, vec3(-1, 1, 1)*_size, vec3(-1, 1,-1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3( 1,-1, 1)*_size, vec3( 1,-1,-1)*_size, vec3( 1, 1,-1)*_size, vec3( 1, 1, 1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3(-1,-1, 1)*_size, vec3(-1,-1,-1)*_size, vec3( 1,-1,-1)*_size, vec3( 1,-1, 1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3(-1, 1,-1)*_size, vec3(-1, 1, 1)*_size, vec3( 1, 1, 1)*_size, vec3( 1, 1,-1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3(-1, 1,-1)*_size, vec3(-1,-1,-1)*_size, vec3(-1,-1, 1)*_size, vec3(-1, 1, 1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3( 1,-1,-1)*_size, vec3( 1, 1,-1)*_size, vec3( 1, 1, 1)*_size, vec3( 1,-1, 1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3(-1,-1,-1)*_size, vec3(-1, 1,-1)*_size, vec3( 1, 1,-1)*_size, vec3( 1,-1,-1)*_size, _color);
|
||||
out->addQuad(_materialName, vec3(-1, 1, 1)*_size, vec3(-1,-1, 1)*_size, vec3( 1,-1, 1)*_size, vec3( 1, 1, 1)*_size, _color);
|
||||
out->setNormalMode(ege::resource::Mesh::normalMode::face);
|
||||
out->calculateNormaleFace(_materialName);
|
||||
// generate the VBO
|
||||
|
@ -26,54 +26,54 @@ ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCylinder(floa
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
|
||||
float y = _size*0.5f;
|
||||
vec3 v1 = vec3(0.0f, y, 0.0f);
|
||||
float z = _size*0.5f;
|
||||
vec3 v1 = vec3(0.0f, 0.0f, z);
|
||||
|
||||
float x = cos(lng)*_radius;
|
||||
float z = sin(lng)*_radius;
|
||||
float y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, z);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
z = sin(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
out->addTriangle(_materialName, v1, v3, v2, _color);
|
||||
out->addTriangle(_materialName, v1, v2, v3, _color);
|
||||
}
|
||||
// Cylinder
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
|
||||
float y = _size*0.5f;
|
||||
float z = _size*0.5f;
|
||||
|
||||
float x = cos(lng)*_radius;
|
||||
float z = sin(lng)*_radius;
|
||||
float y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, z);
|
||||
vec3 v2b = vec3(x, -y, z);
|
||||
vec3 v2b = vec3(x, y, -z);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
z = sin(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
vec3 v3b = vec3(x, -y, z);
|
||||
vec3 v3b = vec3(x, y, -z);
|
||||
|
||||
out->addQuad(_materialName, v2, v3, v3b, v2b, _color);
|
||||
out->addQuad(_materialName, v3, v2, v2b, v3b, _color);
|
||||
}
|
||||
// center to border (BUTTOM)
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
|
||||
float y = _size*-0.5f;
|
||||
vec3 v1 = vec3(0.0f, y, 0.0f);
|
||||
float z = _size*-0.5f;
|
||||
vec3 v1 = vec3(0.0f, 0.0f, z);
|
||||
|
||||
float x = cos(lng)*_radius;
|
||||
float z = sin(lng)*_radius;
|
||||
float y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, z);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
z = sin(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
out->addTriangle(_materialName, v1, v2, v3, _color);
|
||||
out->addTriangle(_materialName, v1, v3, v2, _color);
|
||||
}
|
||||
out->setNormalMode(ege::resource::Mesh::normalMode::face);
|
||||
out->calculateNormaleFace(_materialName);
|
||||
|
@ -23,28 +23,28 @@ ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createSphere(float
|
||||
out->addFaceIndexing(_materialName);
|
||||
for(int32_t iii=0; iii<=_lats; ++iii) {
|
||||
float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
|
||||
float y0 = _radius*sin(lat0);
|
||||
float yr0 = _radius*cos(lat0);
|
||||
float z0 = _radius*sin(lat0);
|
||||
float zr0 = _radius*cos(lat0);
|
||||
|
||||
float lat1 = M_PI * (-0.5f + float(iii) / _lats);
|
||||
float y1 = _radius*sin(lat1);
|
||||
float yr1 = _radius*cos(lat1);
|
||||
float z1 = _radius*sin(lat1);
|
||||
float zr1 = _radius*cos(lat1);
|
||||
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
float x = cos(lng);
|
||||
float z = sin(lng);
|
||||
vec3 v1 = vec3(x * yr1, y1, z * yr1);
|
||||
vec3 v4 = vec3(x * yr0, y0, z * yr0);
|
||||
float y = sin(lng);
|
||||
vec3 v1 = vec3(x * zr1, y * zr1, z1);
|
||||
vec3 v4 = vec3(x * zr0, y * zr0, z0);
|
||||
|
||||
lng = 2 * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng);
|
||||
z = sin(lng);
|
||||
vec3 v2 = vec3(x * yr1, y1, z * yr1);
|
||||
vec3 v3 = vec3(x * yr0, y0, z * yr0);
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0);
|
||||
|
||||
out->addTriangle(_materialName, v1, v2, v3, _color);
|
||||
out->addTriangle(_materialName, v1, v3, v4, _color);
|
||||
out->addTriangle(_materialName, v1, v3, v2, _color);
|
||||
out->addTriangle(_materialName, v1, v4, v3, _color);
|
||||
}
|
||||
}
|
||||
out->setNormalMode(ege::resource::Mesh::normalMode::face);
|
||||
|
@ -128,19 +128,19 @@ void appl::Windows::init() {
|
||||
// create the 6 border that destroy the object when percuted:
|
||||
|
||||
// create cubes ...
|
||||
myMesh = ege::resource::Mesh::createCube(vec3(200,0.2,200), "basics", etk::color::green);
|
||||
myMesh = ege::resource::Mesh::createCube(vec3(200,200,0.2), "basics", etk::color::green);
|
||||
if (myMesh != nullptr) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,-200,0), etk::Quaternion::identity());
|
||||
etk::Transform3D transform(vec3(0,0,-200), etk::Quaternion::identity());
|
||||
// 2nd something to diplay:
|
||||
ememory::SharedPtr<ege::render::Component> componentRender = ememory::makeShared<ege::render::Component>(myMesh);
|
||||
entity->addComponent(componentRender);
|
||||
// 3rd some physic:
|
||||
ememory::SharedPtr<ege::physics::Component> componentPhysics = ememory::makeShared<ege::physics::Component>(m_env, transform);
|
||||
ememory::SharedPtr<ege::physics::shape::Box> physic = ememory::makeShared<ege::physics::shape::Box>();
|
||||
physic->setSize(vec3(200.01,0.21,200.01));
|
||||
physic->setSize(vec3(200.01,200.01,0.21));
|
||||
componentPhysics->addShape(physic);
|
||||
// The entity can not move
|
||||
componentPhysics->setType(ege::physics::Component::type::bodyStatic);
|
||||
@ -153,7 +153,7 @@ void appl::Windows::init() {
|
||||
|
||||
|
||||
// create cubes ...
|
||||
myMesh = ege::resource::Mesh::createCube(vec3(3,0.2,5), "basics", etk::color::green);
|
||||
myMesh = ege::resource::Mesh::createCube(vec3(5,0.2,5), "basics", etk::color::green);
|
||||
if (myMesh != nullptr) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
@ -165,7 +165,7 @@ void appl::Windows::init() {
|
||||
// 3rd some physic:
|
||||
ememory::SharedPtr<ege::physics::Component> componentPhysics = ememory::makeShared<ege::physics::Component>(m_env, transform);
|
||||
ememory::SharedPtr<ege::physics::shape::Box> physic = ememory::makeShared<ege::physics::shape::Box>();
|
||||
physic->setSize(vec3(3.01,0.21,5.01));
|
||||
physic->setSize(vec3(5.01,0.21,5.01));
|
||||
physic->setMass(300000);
|
||||
componentPhysics->addShape(physic);
|
||||
componentPhysics->generate();
|
||||
@ -217,7 +217,7 @@ void appl::Windows::init() {
|
||||
// add it ..
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCylinder(4, 8, "basics", etk::color::blue);
|
||||
myMesh = ege::resource::Mesh::createCylinder(4, 15, "basics", etk::color::blue);
|
||||
if (myMesh != nullptr) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
@ -232,7 +232,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::physics::Component> componentPhysics = ememory::makeShared<ege::physics::Component>(m_env, transform);
|
||||
ememory::SharedPtr<ege::physics::shape::Cylinder> physic = ememory::makeShared<ege::physics::shape::Cylinder>();
|
||||
physic->setRadius(4.01);
|
||||
physic->setSize(8.01);
|
||||
physic->setSize(15.01);
|
||||
physic->setMass(500000);
|
||||
componentPhysics->addShape(physic);
|
||||
componentPhysics->generate();
|
||||
@ -240,7 +240,7 @@ void appl::Windows::init() {
|
||||
// add it ..
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCapsule(4, 8, "basics", etk::color::purple);
|
||||
myMesh = ege::resource::Mesh::createCapsule(4, 15, "basics", etk::color::purple);
|
||||
if (myMesh != nullptr) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
@ -255,7 +255,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::physics::Component> componentPhysics = ememory::makeShared<ege::physics::Component>(m_env, transform);
|
||||
ememory::SharedPtr<ege::physics::shape::Capsule> physic = ememory::makeShared<ege::physics::shape::Capsule>();
|
||||
physic->setRadius(4.01);
|
||||
physic->setSize(8.01);
|
||||
physic->setSize(15.01);
|
||||
physic->setMass(500000);
|
||||
componentPhysics->addShape(physic);
|
||||
componentPhysics->generate();
|
||||
@ -263,7 +263,7 @@ void appl::Windows::init() {
|
||||
// add it ..
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCone(4, 8, "basics", etk::color::purple);
|
||||
myMesh = ege::resource::Mesh::createCone(4, 15, "basics", etk::color::purple);
|
||||
if (myMesh != nullptr) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
@ -278,7 +278,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::physics::Component> componentPhysics = ememory::makeShared<ege::physics::Component>(m_env, transform);
|
||||
ememory::SharedPtr<ege::physics::shape::Cone> physic = ememory::makeShared<ege::physics::shape::Cone>();
|
||||
physic->setRadius(4.01);
|
||||
physic->setSize(8.01);
|
||||
physic->setSize(15.01);
|
||||
physic->setMass(500000);
|
||||
componentPhysics->addShape(physic);
|
||||
componentPhysics->generate();
|
||||
|
@ -228,7 +228,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
ememory::SharedPtr<ege::physics::Component> componentPhysics = ememory::makeShared<ege::physics::Component>(m_env, transform);
|
||||
ememory::SharedPtr<ege::physics::shape::Box> physic = ememory::makeShared<ege::physics::shape::Box>();
|
||||
physic->setSize(vec3(1.01,1.01,1.01));
|
||||
physic->setMass(1000);
|
||||
physic->setMass(0.1);
|
||||
componentPhysics->setType(ege::physics::Component::type::bodyDynamic);
|
||||
componentPhysics->addShape(physic);
|
||||
componentPhysics->generate();
|
||||
|
Loading…
x
Reference in New Issue
Block a user