GL - working on weapon
This commit is contained in:
parent
9f64a1b441
commit
3a80a71143
|
@ -95,22 +95,22 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
|
||||||
heldObject = NULL;
|
heldObject = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Oyster::Math::Float3 up = owner->GetOrientation().v[1];
|
|
||||||
Oyster::Math::Float3 look = owner->GetLookDir();
|
Oyster::Math::Float radius = 2;
|
||||||
Oyster::Math::Float3 pos = owner->GetPosition();
|
Oyster::Math::Float3 look = owner->GetLookDir().GetNormalized();
|
||||||
|
Oyster::Math::Float lenght = 5;
|
||||||
|
Oyster::Math::Float3 pos = owner->GetRigidBody()->GetState().centerPos;
|
||||||
|
|
||||||
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (200 * dt);
|
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (200 * dt);
|
||||||
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(look, up, pos);
|
|
||||||
|
|
||||||
Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/8,1,1,50);
|
Oyster::Collision3D::Cone *hitCone = new Oyster::Collision3D::Cone(look*5,pos,radius);
|
||||||
Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace));
|
|
||||||
|
|
||||||
|
|
||||||
Oyster::Collision3D::Cone *hitCone;
|
|
||||||
forcePushData args;
|
forcePushData args;
|
||||||
args.pushForce = pushForce;
|
args.pushForce = pushForce;
|
||||||
|
|
||||||
//Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction);
|
Oyster::Physics::API::Instance().ApplyEffect(hitCone,&args,ForcePushAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
|
|
@ -123,19 +123,20 @@ using namespace GameLogic;
|
||||||
|
|
||||||
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void *args)
|
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void *args)
|
||||||
{
|
{
|
||||||
Oyster::Physics::ICustomBody::State state;
|
if(obj->GetState().mass == 0) return;
|
||||||
|
|
||||||
Object *realObj = (Object*)obj->GetCustomTag();
|
Object *realObj = (Object*)obj->GetCustomTag();
|
||||||
|
|
||||||
if(realObj->GetObjectType() == OBJECT_TYPE_PLAYER || realObj->GetObjectType() == OBJECT_TYPE_WORLD)
|
if(realObj->GetObjectType() == OBJECT_TYPE_PLAYER || realObj->GetObjectType() == OBJECT_TYPE_WORLD)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
state = obj->GetState();
|
obj->ApplyImpulse(((forcePushData*)(args))->pushForce);
|
||||||
//state.ApplyLinearImpulse(((forcePushData*)(args))->pushForce);
|
|
||||||
obj->SetState(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttatchmentMassDriver::AttemptPickUp(Oyster::Physics::ICustomBody *obj, void* args)
|
void AttatchmentMassDriver::AttemptPickUp(Oyster::Physics::ICustomBody *obj, void* args)
|
||||||
{
|
{
|
||||||
|
if(obj->GetState().mass == 0) return;
|
||||||
|
|
||||||
AttatchmentMassDriver *weapon = ((AttatchmentMassDriver*)args);
|
AttatchmentMassDriver *weapon = ((AttatchmentMassDriver*)args);
|
||||||
|
|
||||||
if(weapon->hasObject)
|
if(weapon->hasObject)
|
||||||
|
|
|
@ -15,14 +15,14 @@ Cone::Cone( ) : ICollideable(Type_cone)
|
||||||
this->height = Oyster::Math::Float3(0,0,0);
|
this->height = Oyster::Math::Float3(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Cone::Cone( const ::Oyster::Math::Float3 &height, const Oyster::Math::Float3 &position, const ::Oyster::Math::Float &radius )
|
Cone::Cone( const ::Oyster::Math::Float3 &height, const Oyster::Math::Float3 &position, const ::Oyster::Math::Float &radius ) : ICollideable(Type_cone)
|
||||||
{
|
{
|
||||||
this->radius = radius;
|
this->radius = radius;
|
||||||
this->height = height;
|
this->height = height;
|
||||||
this->position = position;
|
this->position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cone::Cone( const ::Oyster::Math::Float4 &height, const Oyster::Math::Float4 &position, const ::Oyster::Math::Float &radius )
|
Cone::Cone( const ::Oyster::Math::Float4 &height, const Oyster::Math::Float4 &position, const ::Oyster::Math::Float &radius ) : ICollideable(Type_cone)
|
||||||
{
|
{
|
||||||
this->radius = radius;
|
this->radius = radius;
|
||||||
this->height = (Oyster::Math::Float3)height;
|
this->height = (Oyster::Math::Float3)height;
|
||||||
|
@ -42,3 +42,8 @@ Cone & Cone::operator = ( const Cone &cone )
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::Utility::DynamicMemory::UniquePointer<ICollideable> Cone::Clone( ) const
|
||||||
|
{
|
||||||
|
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Cone(*this) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,15 @@ namespace Oyster
|
||||||
|
|
||||||
Cone & operator = ( const Cone &Cone );
|
Cone & operator = ( const Cone &Cone );
|
||||||
|
|
||||||
|
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||||
|
|
||||||
|
bool Intersects( const ICollideable &target ) const{return false;};
|
||||||
|
bool Intersects( const ICollideable &target, ::Oyster::Math::Float4 &worldPointOfContact ) const{return false;};
|
||||||
|
bool Contains( const ICollideable &target ) const{return false;};
|
||||||
|
|
||||||
|
::Oyster::Math::Float TimeOfContact( const ICollideable &deuterStart, const ICollideable &deuterEnd ) const{return 0;};
|
||||||
|
|
||||||
|
|
||||||
Oyster::Math::Float3 height;
|
Oyster::Math::Float3 height;
|
||||||
Oyster::Math::Float3 position;
|
Oyster::Math::Float3 position;
|
||||||
Oyster::Math::Float radius;
|
Oyster::Math::Float radius;
|
||||||
|
|
Loading…
Reference in New Issue