Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1992b6cde1 | |||
| c82be79bb8 | |||
| 35a8d45fa4 |
+1
-1
Submodule assets updated: 33455a9d10...298641b1af
@@ -84,18 +84,6 @@ bool AABBvsTriangles(const AABB& box,
|
|||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
const glm::mat4& modelMatrix);
|
const glm::mat4& modelMatrix);
|
||||||
|
|
||||||
enum Output
|
|
||||||
{
|
|
||||||
OutContained,
|
|
||||||
OutSeparated,
|
|
||||||
OutIntersecting
|
|
||||||
};
|
|
||||||
//Detects intersection and containment.
|
|
||||||
Output AABBvsTrianglesWContainment(const AABB& box,
|
|
||||||
const RawModel::Vertex* modelVertices,
|
|
||||||
const std::vector<unsigned int>& modelIndices,
|
|
||||||
const glm::mat4& modelMatrix);
|
|
||||||
|
|
||||||
//Return true if the boxes are intersecting.
|
//Return true if the boxes are intersecting.
|
||||||
bool AABBVsAABB(const AABB& a, const AABB& b);
|
bool AABBVsAABB(const AABB& a, const AABB& b);
|
||||||
//Return true if the boxes are intersecting.
|
//Return true if the boxes are intersecting.
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ public:
|
|||||||
virtual const glm::vec3 Rotation() const { return m_Rotation; }
|
virtual const glm::vec3 Rotation() const { return m_Rotation; }
|
||||||
virtual bool Jumping() const { return m_Jumping; }
|
virtual bool Jumping() const { return m_Jumping; }
|
||||||
virtual bool Crouching() const { return m_Crouching; }
|
virtual bool Crouching() const { return m_Crouching; }
|
||||||
virtual bool CrouchingLastFrame() const { return m_CrouchingLastFrame; }
|
|
||||||
virtual bool DoubleJumping() const { return m_DoubleJumping; }
|
virtual bool DoubleJumping() const { return m_DoubleJumping; }
|
||||||
virtual void SetDoubleJumping(bool isDoubleJumping) {
|
virtual void SetDoubleJumping(bool isDoubleJumping) {
|
||||||
m_DoubleJumping = isDoubleJumping;
|
m_DoubleJumping = isDoubleJumping;
|
||||||
@@ -45,7 +44,6 @@ protected:
|
|||||||
bool m_Jumping = false;
|
bool m_Jumping = false;
|
||||||
bool m_DoubleJumping = false;
|
bool m_DoubleJumping = false;
|
||||||
bool m_Crouching = false;
|
bool m_Crouching = false;
|
||||||
bool m_CrouchingLastFrame = false;
|
|
||||||
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
||||||
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
||||||
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
|
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
|
||||||
@@ -84,7 +82,6 @@ void FirstPersonInputController<EventContext>::Reset()
|
|||||||
{
|
{
|
||||||
m_Rotation = glm::vec3(0.f, 0.f, 0.f);
|
m_Rotation = glm::vec3(0.f, 0.f, 0.f);
|
||||||
m_Jumping = false;
|
m_Jumping = false;
|
||||||
m_CrouchingLastFrame = m_Crouching;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename EventContext>
|
template <typename EventContext>
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ private:
|
|||||||
bool CapturePointSystem::OnTriggerLeave(const Events::TriggerLeave& e);
|
bool CapturePointSystem::OnTriggerLeave(const Events::TriggerLeave& e);
|
||||||
EventRelay<CapturePointSystem, Events::Captured> m_ECaptured;
|
EventRelay<CapturePointSystem, Events::Captured> m_ECaptured;
|
||||||
bool CapturePointSystem::OnCaptured(const Events::Captured& e);
|
bool CapturePointSystem::OnCaptured(const Events::Captured& e);
|
||||||
void ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner);
|
|
||||||
|
|
||||||
bool m_WinnerWasFound = false;
|
bool m_WinnerWasFound = false;
|
||||||
//need to track these variables for the captureSystem to work as per design!
|
//need to track these variables for the captureSystem to work as per design!
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Input/EInputCommand.h"
|
#include "Input/EInputCommand.h"
|
||||||
#include "Network/EPlayerDisconnected.h"
|
|
||||||
|
|
||||||
class SpectatorCameraSystem : public ImpureSystem
|
class SpectatorCameraSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -18,8 +17,6 @@ private:
|
|||||||
|
|
||||||
EventRelay<SpectatorCameraSystem, Events::InputCommand> m_EInputCommand;
|
EventRelay<SpectatorCameraSystem, Events::InputCommand> m_EInputCommand;
|
||||||
bool OnInputCommand(const Events::InputCommand& e);
|
bool OnInputCommand(const Events::InputCommand& e);
|
||||||
EventRelay<SpectatorCameraSystem, Events::PlayerDisconnected> m_EDisconnect;
|
|
||||||
bool OnDisconnect(const Events::PlayerDisconnected& e);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -27,9 +27,12 @@ private:
|
|||||||
std::random_device m_RandomDevice;
|
std::random_device m_RandomDevice;
|
||||||
std::mt19937 m_RandomEngine;
|
std::mt19937 m_RandomEngine;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Weapon functions
|
// Weapon functions
|
||||||
void fireShell(ComponentWrapper cWeapon, WeaponInfo& wi);
|
void fireShell(ComponentWrapper cWeapon, WeaponInfo& wi);
|
||||||
void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage);
|
void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, const std::vector<glm::vec2>& pattern);
|
||||||
|
void spawnTracers(ComponentWrapper cWeapon, WeaponInfo& wi, std::vector<glm::vec2> pattern);
|
||||||
bool canFire(ComponentWrapper cWeapon, WeaponInfo& wi);
|
bool canFire(ComponentWrapper cWeapon, WeaponInfo& wi);
|
||||||
|
|
||||||
// Utility
|
// Utility
|
||||||
|
|||||||
@@ -29,6 +29,4 @@ K=TakeDamage,1500
|
|||||||
F2=PerformanceTimingResetAllTimers
|
F2=PerformanceTimingResetAllTimers
|
||||||
F3=PerformanceTimingCreateExcelData
|
F3=PerformanceTimingCreateExcelData
|
||||||
Comma=SwapToClassPick
|
Comma=SwapToClassPick
|
||||||
Period=SwapToTeamPick
|
Period=SwapToTeamPick
|
||||||
Enter=PickClass,1
|
|
||||||
F5=DisconnectFromServer
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<DefenderWeapon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DefenderWeapon.xsd">
|
<DefenderWeapon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DefenderWeapon.xsd">
|
||||||
<Slot><Primary/></Slot>
|
<Slot><Primary/></Slot>
|
||||||
<MagazineAmmo>8</MagazineAmmo>
|
<MagazineAmmo>9999</MagazineAmmo>
|
||||||
<MagazineSize>8</MagazineSize>
|
<MagazineSize>8</MagazineSize>
|
||||||
<Ammo>64</Ammo>
|
<Ammo>64</Ammo>
|
||||||
<MaxAmmo>64</MaxAmmo>
|
<MaxAmmo>64</MaxAmmo>
|
||||||
<BaseDamage>90</BaseDamage>
|
<BaseDamage>90</BaseDamage>
|
||||||
<SpreadAngle>0.174533</SpreadAngle> <!-- 0.174533 = 10 degrees -->
|
<SpreadAngle>10</SpreadAngle>
|
||||||
<MaxTravelAngle>0.174533</MaxTravelAngle> <!-- 0.174533 = 10 degrees -->
|
<MaxTravelAngle>0.174533</MaxTravelAngle> <!-- 0.174533 = 10 degrees -->
|
||||||
<NumPellets>10</NumPellets>
|
<NumPellets>9</NumPellets>
|
||||||
<RPM>120</RPM>
|
<RPM>120</RPM>
|
||||||
<ViewPunch>0.03</ViewPunch>
|
<ViewPunch>0.03</ViewPunch>
|
||||||
<ViewReturnSpeed>0.2</ViewReturnSpeed>
|
<ViewReturnSpeed>0.2</ViewReturnSpeed>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<xs:annotation><xs:documentation>Damage dealt if all shotgun pellets hit</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Damage dealt if all shotgun pellets hit</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="SpreadAngle" type="t:float" minOccurs="0">
|
<xs:element name="SpreadAngle" type="t:float" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Spread angle in radians</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>The spread angle radius.</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="MaxTravelAngle" type="t:float" minOccurs="0">
|
<xs:element name="MaxTravelAngle" type="t:float" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Maximum vertical aim travel angle in radians</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Maximum vertical aim travel angle in radians</xs:documentation></xs:annotation>
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="RayBlue">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Orientation X="0" Y="0.174532995" Z="0"/>
|
||||||
|
<Scale X="0" Y="1" Z="100"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
|
||||||
|
<Color A="0.419607848" B="3.92156863" G="0.270588249" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
<Orientation X="0" Y="-1.57099998" Z="0"/>
|
||||||
|
<Scale X="1" Y="0.0260000005" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
|
||||||
|
<Color A="0.419607848" B="3.92156863" G="0.270588249" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
<Orientation X="0" Y="4.71218538" Z="3.14199996"/>
|
||||||
|
<Scale X="1" Y="0.0260000005" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="RayBlue">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0" Y="1" Z="100"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
|
||||||
|
<Color A="0.419607848" B="3.92156863" G="0.270588249" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
<Orientation X="0" Y="-1.57099998" Z="0"/>
|
||||||
|
<Scale X="1" Y="0.0260000005" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
|
||||||
|
<Color A="0.419607848" B="3.92156863" G="0.270588249" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
<Orientation X="0" Y="4.71218538" Z="3.14199996"/>
|
||||||
|
<Scale X="1" Y="0.0260000005" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -1,39 +1,95 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<Entity name="Shield" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
<Components>
|
<Components>
|
||||||
<c:Blend>
|
<c:Transform>
|
||||||
<Pose1>Deploy</Pose1>
|
<Position X="1.70262027" Y="0.261695802" Z="-3.26634645"/>
|
||||||
<Pose2>Idle</Pose2>
|
</c:Transform>
|
||||||
<Weight>0</Weight>
|
|
||||||
</c:Blend>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Characters/Defender/DefenderShield.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="Deploy">
|
<Entity name="Back">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Blend>
|
||||||
<AnimationName>ActivateDeactiveShieldF</AnimationName>
|
<Pose1>Deploy</Pose1>
|
||||||
<Time>1</Time>
|
<Pose2>Idle</Pose2>
|
||||||
<Speed>1</Speed>
|
<Weight>0</Weight>
|
||||||
</c:Animation>
|
</c:Blend>
|
||||||
|
<c:Shielded/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Characters/Defender/DefenderShieldBack.mesh</Resource>
|
||||||
|
<Color A="0.219607845" B="3.92156863" G="1" R="1"/>
|
||||||
|
<Shadow>false</Shadow>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
<NormalMap>false</NormalMap>
|
||||||
|
<DiffuseTexture>false</DiffuseTexture>
|
||||||
|
<SpecularMap>false</SpecularMap>
|
||||||
|
<GlowMap>false</GlowMap>
|
||||||
|
</c:Model>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children>
|
||||||
|
<Entity name="Deploy">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>ActivateDeactiveShieldF</AnimationName>
|
||||||
|
<Play>true</Play>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Idle">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>ShieldFrontF</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Idle">
|
<Entity name="Front">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Blend>
|
||||||
<AnimationName>ShieldFrontF</AnimationName>
|
<Pose1>Deploy</Pose1>
|
||||||
<Speed>1</Speed>
|
<Pose2>Idle</Pose2>
|
||||||
</c:Animation>
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Characters/Defender/DefenderShieldFront.mesh</Resource>
|
||||||
|
<Color A="0.219607845" B="3.92156863" G="1" R="1"/>
|
||||||
|
<Shadow>false</Shadow>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
<NormalMap>false</NormalMap>
|
||||||
|
<DiffuseTexture>false</DiffuseTexture>
|
||||||
|
<SpecularMap>false</SpecularMap>
|
||||||
|
<GlowMap>false</GlowMap>
|
||||||
|
</c:Model>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children>
|
||||||
|
<Entity name="Deploy">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>ActivateDeactiveShieldF</AnimationName>
|
||||||
|
<Play>true</Play>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Idle">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>ShieldFrontF</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>10</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:ExplosionEffect>
|
||||||
|
<Velocity X="2" Y="2.30000019" Z="0"/>
|
||||||
|
<ExplosionDuration>1</ExplosionDuration>
|
||||||
|
<Randomness>true</Randomness>
|
||||||
|
<ExponentialAccelaration>true</ExponentialAccelaration>
|
||||||
|
</c:ExplosionEffect>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
|
<Color A="1" B="1" G="1" R="3.92156863"/>
|
||||||
|
<Shadow>false</Shadow>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
<Color A="1" B="1" G="0.254901975" R="0"/>
|
<Color A="1" B="1" G="0.254901975" R="0"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.600000024" Y="0" Z="0"/>
|
<Position X="0.800000012" Y="0" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
<Color A="1" B="1" G="0.254901975" R="0"/>
|
<Color A="1" B="1" G="0.254901975" R="0"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.800000012" Y="0" Z="0"/>
|
<Position X="-0.600000024" Y="0" Z="0.549540162"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -157,14 +157,106 @@
|
|||||||
<Resource>Models/Weapons/Blue/DefenderWeaponBlue.mesh</Resource>
|
<Resource>Models/Weapons/Blue/DefenderWeaponBlue.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.00681143999" Y="-0.204994932" Z="-0.209244296"/>
|
<Orientation X="0" Y="-0" Z="0"/>
|
||||||
<Orientation X="-0.581807375" Y="0.562133908" Z="-0.0719003305"/>
|
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.870232701" Y="0.640069604" Z="4.07769537"/>
|
||||||
|
<Orientation X="0" Y="4.71238565" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="RayBlue">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Orientation X="0" Y="0.174532995" Z="0"/>
|
||||||
|
<Scale X="0" Y="1" Z="100"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
|
||||||
|
<Color A="0.419607848" B="3.92156863" G="0.270588249" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
<Orientation X="0" Y="-1.57099998" Z="0"/>
|
||||||
|
<Scale X="1" Y="0.0260000005" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
|
||||||
|
<Color A="0.419607848" B="3.92156863" G="0.270588249" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
<Orientation X="0" Y="4.71218538" Z="3.14199996"/>
|
||||||
|
<Scale X="1" Y="0.0260000005" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="RayBlue">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0" Y="1" Z="100"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
|
||||||
|
<Color A="0.419607848" B="3.92156863" G="0.270588249" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
<Orientation X="0" Y="-1.57099998" Z="0"/>
|
||||||
|
<Scale X="1" Y="0.0260000005" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Effects/Ray.png</DiffuseTexture>
|
||||||
|
<Color A="0.419607848" B="3.92156863" G="0.270588249" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
<Orientation X="0" Y="4.71218538" Z="3.14199996"/>
|
||||||
|
<Scale X="1" Y="0.0260000005" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<Components>
|
<Components>
|
||||||
<c:Lifetime>
|
<c:Lifetime>
|
||||||
<Lifetime>0.10000000149011612</Lifetime>
|
<Lifetime>10</Lifetime>
|
||||||
</c:Lifetime>
|
</c:Lifetime>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Scale X="0" Y="1" Z="1"/>
|
<Scale X="0" Y="1" Z="1"/>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>models/core/unitcube.mesh</Resource>
|
<Resource>models/core/unitcube.mesh</Resource>
|
||||||
<Color A="1" B="0.980392158" G="1" R="1"/>
|
<Color A="1" B="0.980392158" G="1" R="1"/>
|
||||||
<Shadow>false</Shadow>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.100000001" Y="0" Z="0"/>
|
<Position X="-0.100000001" Y="0" Z="0"/>
|
||||||
@@ -29,7 +28,6 @@
|
|||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>models/core/unitcube.mesh</Resource>
|
<Resource>models/core/unitcube.mesh</Resource>
|
||||||
<Color A="1" B="0" G="0" R="1"/>
|
<Color A="1" B="0" G="0" R="1"/>
|
||||||
<Shadow>false</Shadow>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-14.500001" Y="1.50000012" Z="16.9222012"/>
|
<Position X="-14.500001" Y="1.50000012" Z="16.9222012"/>
|
||||||
@@ -54,7 +52,6 @@
|
|||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>models/core/unitcube.mesh</Resource>
|
<Resource>models/core/unitcube.mesh</Resource>
|
||||||
<Color A="1" B="1" G="0" R="0"/>
|
<Color A="1" B="1" G="0" R="0"/>
|
||||||
<Shadow>false</Shadow>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-14.500001" Y="1.50000012" Z="-17.6888409"/>
|
<Position X="-14.500001" Y="1.50000012" Z="-17.6888409"/>
|
||||||
@@ -70,7 +67,6 @@
|
|||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>models/core/unitcube.mesh</Resource>
|
<Resource>models/core/unitcube.mesh</Resource>
|
||||||
<Color A="1" B="0" G="0" R="1"/>
|
<Color A="1" B="0" G="0" R="1"/>
|
||||||
<Shadow>false</Shadow>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="12.1000004" Y="1.50000012" Z="16.9222012"/>
|
<Position X="12.1000004" Y="1.50000012" Z="16.9222012"/>
|
||||||
@@ -86,7 +82,6 @@
|
|||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>models/core/unitcube.mesh</Resource>
|
<Resource>models/core/unitcube.mesh</Resource>
|
||||||
<Color A="1" B="1" G="0" R="0"/>
|
<Color A="1" B="1" G="0" R="0"/>
|
||||||
<Shadow>false</Shadow>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="12.1228638" Y="1.50000012" Z="-17.9642811"/>
|
<Position X="12.1228638" Y="1.50000012" Z="-17.9642811"/>
|
||||||
@@ -104,7 +99,7 @@
|
|||||||
</c:Team>
|
</c:Team>
|
||||||
<c:PlayerSpawn/>
|
<c:PlayerSpawn/>
|
||||||
<c:Spawner>
|
<c:Spawner>
|
||||||
<EntityFile>Schema/Entities/PlayerRed.xml</EntityFile>
|
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||||
</c:Spawner>
|
</c:Spawner>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -203,7 +198,6 @@
|
|||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>models/core/unitcube.mesh</Resource>
|
<Resource>models/core/unitcube.mesh</Resource>
|
||||||
<Color A="1" B="39.2156868" G="0" R="3.13725495"/>
|
<Color A="1" B="39.2156868" G="0" R="3.13725495"/>
|
||||||
<Shadow>false</Shadow>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Scale X="-70" Y="-70" Z="-70"/>
|
<Scale X="-70" Y="-70" Z="-70"/>
|
||||||
@@ -216,7 +210,7 @@
|
|||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="CapP">
|
<Entity name="-">
|
||||||
<Components>
|
<Components>
|
||||||
<c:AABB/>
|
<c:AABB/>
|
||||||
<c:CapturePoint>
|
<c:CapturePoint>
|
||||||
@@ -231,11 +225,6 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
<c:Model>
|
|
||||||
<Resource></Resource>
|
|
||||||
<Color A="0.300000012" B="0" G="0" R="1"/>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="-4.10000038"/>
|
<Position X="0" Y="0" Z="-4.10000038"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
@@ -250,24 +239,7 @@
|
|||||||
<Scale X="2.70000005" Y="3.4000001" Z="4.60000038"/>
|
<Scale X="2.70000005" Y="3.4000001" Z="4.60000038"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children/>
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource></Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:PointLight/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Blue">
|
<Entity name="Blue">
|
||||||
<Components>
|
<Components>
|
||||||
@@ -278,25 +250,7 @@
|
|||||||
<Scale X="3.4000001" Y="4.70000029" Z="0.700000048"/>
|
<Scale X="3.4000001" Y="4.70000029" Z="0.700000048"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children/>
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource></Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:PointLight/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Spectator">
|
<Entity name="Spectator">
|
||||||
<Components>
|
<Components>
|
||||||
@@ -307,43 +261,7 @@
|
|||||||
<Scale X="1" Y="5.70000029" Z="1"/>
|
<Scale X="1" Y="5.70000029" Z="1"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children/>
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:PointLight/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource></Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:PointLight/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource></Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
@@ -354,11 +272,11 @@
|
|||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="CapP">
|
<Entity name="-">
|
||||||
<Components>
|
<Components>
|
||||||
<c:AABB/>
|
<c:AABB/>
|
||||||
<c:CapturePoint>
|
<c:CapturePoint>
|
||||||
<CaptureTimer>12</CaptureTimer>
|
<CaptureTimer>-15</CaptureTimer>
|
||||||
<HomePointForTeam>
|
<HomePointForTeam>
|
||||||
<Blue/>
|
<Blue/>
|
||||||
</HomePointForTeam>
|
</HomePointForTeam>
|
||||||
@@ -384,38 +302,7 @@
|
|||||||
<Scale X="4.4000001" Y="2" Z="3.70000029"/>
|
<Scale X="4.4000001" Y="2" Z="3.70000029"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children/>
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource></Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Blue">
|
<Entity name="Blue">
|
||||||
<Components>
|
<Components>
|
||||||
|
|||||||
@@ -360,14 +360,7 @@ constexpr bool FaceIsGround(float faceNormalY)
|
|||||||
//An array containing 3 int pairs { 0, 2 }, { 0, 1 }, { 1, 2 }
|
//An array containing 3 int pairs { 0, 2 }, { 0, 1 }, { 1, 2 }
|
||||||
constexpr std::array<std::pair<int, int>, 3> dimensionPairs({ std::pair<int, int>(0, 2), std::pair<int, int>(0, 1), std::pair<int, int>(1, 2) });
|
constexpr std::array<std::pair<int, int>, 3> dimensionPairs({ std::pair<int, int>(0, 2), std::pair<int, int>(0, 1), std::pair<int, int>(1, 2) });
|
||||||
|
|
||||||
enum class BoxTriRes
|
bool AABBvsTriangle(const AABB& box,
|
||||||
{
|
|
||||||
Front,
|
|
||||||
Behind,
|
|
||||||
Intersect
|
|
||||||
};
|
|
||||||
|
|
||||||
BoxTriRes AABBvsTriangle(const AABB& box,
|
|
||||||
const std::array<glm::vec3, 3>& triPos,
|
const std::array<glm::vec3, 3>& triPos,
|
||||||
const glm::vec3& originalBoxVelocity,
|
const glm::vec3& originalBoxVelocity,
|
||||||
float verticalStepHeight,
|
float verticalStepHeight,
|
||||||
@@ -381,7 +374,7 @@ BoxTriRes AABBvsTriangle(const AABB& box,
|
|||||||
//Less checks, and we should be able to walk out from models if we are trapped inside.
|
//Less checks, and we should be able to walk out from models if we are trapped inside.
|
||||||
glm::vec3 triNormal = glm::cross(triPos[1] - triPos[0], triPos[2] - triPos[0]);
|
glm::vec3 triNormal = glm::cross(triPos[1] - triPos[0], triPos[2] - triPos[0]);
|
||||||
if (!vectorHasLength(triNormal) || (glm::dot(triNormal, originalBoxVelocity) > 0)) {
|
if (!vectorHasLength(triNormal) || (glm::dot(triNormal, originalBoxVelocity) > 0)) {
|
||||||
return BoxTriRes::Behind;
|
return false;
|
||||||
}
|
}
|
||||||
triNormal = glm::normalize(triNormal);
|
triNormal = glm::normalize(triNormal);
|
||||||
|
|
||||||
@@ -416,9 +409,6 @@ BoxTriRes AABBvsTriangle(const AABB& box,
|
|||||||
const glm::vec3& min = box.MinCorner();
|
const glm::vec3& min = box.MinCorner();
|
||||||
const glm::vec3& max = box.MaxCorner();
|
const glm::vec3& max = box.MaxCorner();
|
||||||
|
|
||||||
// If there is no intersection, whether the box center is in front of or behind the triangle.
|
|
||||||
BoxTriRes noIntersection = glm::dot(triNormal, origin - triPos[0]) > 0 ? BoxTriRes::Front : BoxTriRes::Behind;
|
|
||||||
|
|
||||||
//For each projection in xy-, xz-, and yx-planes.
|
//For each projection in xy-, xz-, and yx-planes.
|
||||||
for (std::pair<int, int> dim : dimensionPairs) {
|
for (std::pair<int, int> dim : dimensionPairs) {
|
||||||
//2D Triangle.
|
//2D Triangle.
|
||||||
@@ -436,7 +426,7 @@ BoxTriRes AABBvsTriangle(const AABB& box,
|
|||||||
bool pushedFromTriangleLine;
|
bool pushedFromTriangleLine;
|
||||||
//if projections don't overlap, return false.
|
//if projections don't overlap, return false.
|
||||||
if (!rectangleVsTriangle(boxMin, boxMax, t2D, resolutionVector, resolutionDist, pushedFromTriangleLine)) {
|
if (!rectangleVsTriangle(boxMin, boxMax, t2D, resolutionVector, resolutionDist, pushedFromTriangleLine)) {
|
||||||
return noIntersection;
|
return false;
|
||||||
} else if (resolveCollision) {
|
} else if (resolveCollision) {
|
||||||
//Overwrite the smallest resolution if this is smaller.
|
//Overwrite the smallest resolution if this is smaller.
|
||||||
if (resolutionDist < resolveShortest.DistanceSq) {
|
if (resolutionDist < resolveShortest.DistanceSq) {
|
||||||
@@ -472,15 +462,14 @@ BoxTriRes AABBvsTriangle(const AABB& box,
|
|||||||
float t = glm::dot(triNormal, triPos[0] - origin) / glm::dot(triNormal, diagonal);
|
float t = glm::dot(triNormal, triPos[0] - origin) / glm::dot(triNormal, diagonal);
|
||||||
//If intersection point between plane and diagonal is within the box.
|
//If intersection point between plane and diagonal is within the box.
|
||||||
if (glm::abs(t) > 1) {
|
if (glm::abs(t) > 1) {
|
||||||
return noIntersection;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resolveCollision) {
|
if (!resolveCollision) {
|
||||||
return BoxTriRes::Intersect;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 cornerResolution = (1+t) * diagonal;
|
glm::vec3 cornerResolution = (1+t) * diagonal;
|
||||||
cornerResolution = glm::dot(cornerResolution, triNormal) * triNormal;
|
|
||||||
//Overwrite the smallest resolution if cornerResolution is smaller.
|
//Overwrite the smallest resolution if cornerResolution is smaller.
|
||||||
float lenSq = glm::length2(cornerResolution);
|
float lenSq = glm::length2(cornerResolution);
|
||||||
if (lenSq < resolveShortest.DistanceSq) {
|
if (lenSq < resolveShortest.DistanceSq) {
|
||||||
@@ -509,7 +498,7 @@ BoxTriRes AABBvsTriangle(const AABB& box,
|
|||||||
case ResolveDimZ:
|
case ResolveDimZ:
|
||||||
//If we get here, the resolution is along one coordinate axis.
|
//If we get here, the resolution is along one coordinate axis.
|
||||||
//set velocity to 0 in y if it is along y-axis.
|
//set velocity to 0 in y if it is along y-axis.
|
||||||
return BoxTriRes::Intersect;
|
return true;
|
||||||
case Line:
|
case Line:
|
||||||
projNorm = glm::normalize(outResolution);
|
projNorm = glm::normalize(outResolution);
|
||||||
break;
|
break;
|
||||||
@@ -544,10 +533,10 @@ BoxTriRes AABBvsTriangle(const AABB& box,
|
|||||||
boxVelocity = boxVelocity - glm::dot(boxVelocity, projNorm) * projNorm;
|
boxVelocity = boxVelocity - glm::dot(boxVelocity, projNorm) * projNorm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BoxTriRes::Intersect;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Output AABBvsTriangles(const AABB& box,
|
bool AABBvsTriangles(const AABB& box,
|
||||||
const RawModel::Vertex* modelVertices,
|
const RawModel::Vertex* modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
const glm::mat4& modelMatrix,
|
const glm::mat4& modelMatrix,
|
||||||
@@ -557,8 +546,8 @@ Output AABBvsTriangles(const AABB& box,
|
|||||||
glm::vec3& outResolutionVector,
|
glm::vec3& outResolutionVector,
|
||||||
bool resolveCollision)
|
bool resolveCollision)
|
||||||
{
|
{
|
||||||
bool intersect = false;
|
bool hit = false;
|
||||||
Output out = Output::OutContained;
|
|
||||||
bool everHitTheGround = false;
|
bool everHitTheGround = false;
|
||||||
AABB newBox = box;
|
AABB newBox = box;
|
||||||
outResolutionVector = glm::vec3(0.f);
|
outResolutionVector = glm::vec3(0.f);
|
||||||
@@ -571,27 +560,20 @@ Output AABBvsTriangles(const AABB& box,
|
|||||||
};
|
};
|
||||||
glm::vec3 outVec;
|
glm::vec3 outVec;
|
||||||
bool collideWithGround = isOnGround;
|
bool collideWithGround = isOnGround;
|
||||||
switch (AABBvsTriangle(newBox, triVertices, originalBoxVelocity, verticalStepHeight, collideWithGround, boxVelocity, outVec, resolveCollision)) {
|
if (AABBvsTriangle(newBox, triVertices, originalBoxVelocity, verticalStepHeight, collideWithGround, boxVelocity, outVec, resolveCollision)) {
|
||||||
case Collision::BoxTriRes::Front:
|
hit = true;
|
||||||
out = Output::OutSeparated;
|
|
||||||
break;
|
|
||||||
case Collision::BoxTriRes::Intersect:
|
|
||||||
intersect = true;
|
|
||||||
outResolutionVector += outVec;
|
outResolutionVector += outVec;
|
||||||
newBox = AABB::FromOriginSize(newBox.Origin() + outVec, newBox.Size());
|
newBox = AABB::FromOriginSize(newBox.Origin() + outVec, newBox.Size());
|
||||||
if (collideWithGround) {
|
if (collideWithGround) {
|
||||||
everHitTheGround = isOnGround = true;
|
everHitTheGround = isOnGround = true;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!everHitTheGround) {
|
if (!everHitTheGround) {
|
||||||
isOnGround = false;
|
isOnGround = false;
|
||||||
}
|
}
|
||||||
return intersect ? Output::OutIntersecting : out;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AABBvsTriangles(const AABB& box,
|
bool AABBvsTriangles(const AABB& box,
|
||||||
@@ -611,31 +593,13 @@ bool AABBvsTriangles(const AABB& box,
|
|||||||
verticalStepHeight,
|
verticalStepHeight,
|
||||||
isOnGround,
|
isOnGround,
|
||||||
outResolutionVector,
|
outResolutionVector,
|
||||||
true) == Output::OutIntersecting;
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AABBvsTriangles(const AABB& box,
|
bool AABBvsTriangles(const AABB& box,
|
||||||
const RawModel::Vertex* modelVertices,
|
const RawModel::Vertex* modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
const glm::mat4& modelMatrix)
|
const glm::mat4& modelMatrix)
|
||||||
{
|
|
||||||
glm::vec3 vel, outres;
|
|
||||||
bool g;
|
|
||||||
return AABBvsTriangles(box,
|
|
||||||
modelVertices,
|
|
||||||
modelIndices,
|
|
||||||
modelMatrix,
|
|
||||||
vel,
|
|
||||||
0.f,
|
|
||||||
g,
|
|
||||||
outres,
|
|
||||||
false) == Output::OutIntersecting;
|
|
||||||
}
|
|
||||||
|
|
||||||
Output AABBvsTrianglesWContainment(const AABB& box,
|
|
||||||
const RawModel::Vertex* modelVertices,
|
|
||||||
const std::vector<unsigned int>& modelIndices,
|
|
||||||
const glm::mat4& modelMatrix)
|
|
||||||
{
|
{
|
||||||
glm::vec3 vel, outres;
|
glm::vec3 vel, outres;
|
||||||
bool g;
|
bool g;
|
||||||
|
|||||||
@@ -37,10 +37,6 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
|||||||
bool hit;
|
bool hit;
|
||||||
float dist;
|
float dist;
|
||||||
if (boxB.Entity.HasComponent("Model")) {
|
if (boxB.Entity.HasComponent("Model")) {
|
||||||
if (!((bool)boxB.Entity["Model"]["Visible"])) {
|
|
||||||
// Don't collide against invisible models.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
RawModel* model;
|
RawModel* model;
|
||||||
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
|
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
|
||||||
try {
|
try {
|
||||||
@@ -81,11 +77,7 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (boxB.Entity.HasComponent("Model") && Collision::AABBVsAABB(boxA, boxB)) {
|
if (boxB.Entity.HasComponent("Model") && Collision::AABBVsAABB(boxA, boxB)) {
|
||||||
// Here we know boxB is a entity with Collideable, AABB, and Model.
|
//Here we know boxB is a entity with Collideable, AABB, and Model.
|
||||||
if (!((bool)boxB.Entity["Model"]["Visible"])) {
|
|
||||||
// Don't collide against invisible models.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
RawModel* model;
|
RawModel* model;
|
||||||
try {
|
try {
|
||||||
model = ResourceManager::Load<RawModel, true>(boxB.Entity["Model"]["Resource"]);
|
model = ResourceManager::Load<RawModel, true>(boxB.Entity["Model"]["Resource"]);
|
||||||
@@ -96,11 +88,12 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
|||||||
glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity);
|
glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity);
|
||||||
|
|
||||||
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
|
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
|
||||||
|
bool notMovingxz = glm::all(glm::lessThan(glm::abs(glm::vec2(inOutVelocity.x, inOutVelocity.z)), glm::vec2(0.01f))) && prevPosIt != m_PrevPositions.end();
|
||||||
bool isOnGround = (bool)cPhysics["IsOnGround"];
|
bool isOnGround = (bool)cPhysics["IsOnGround"];
|
||||||
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
|
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
|
||||||
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
|
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
|
||||||
//Move the position to previous position if it is not moving in the xz-plane, else resolve with the resolution vector.
|
//Move the position to previous position if it is not moving in the xz-plane, else resolve with the resolution vector.
|
||||||
(glm::vec3&)cTransform["Position"] += resolutionVector;
|
(glm::vec3&)cTransform["Position"] += notMovingxz ? prevPosIt->second - boxA.Origin() : resolutionVector;
|
||||||
boxA = *Collision::EntityAbsoluteAABB(entity);
|
boxA = *Collision::EntityAbsoluteAABB(entity);
|
||||||
cPhysics["Velocity"] = inOutVelocity;
|
cPhysics["Velocity"] = inOutVelocity;
|
||||||
if (isOnGround) {
|
if (isOnGround) {
|
||||||
|
|||||||
@@ -10,16 +10,6 @@ void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RawModel* triggerModel = nullptr;
|
|
||||||
glm::mat4 triggerModelMat;
|
|
||||||
if (triggerEntity.HasComponent("Model")) {
|
|
||||||
try {
|
|
||||||
triggerModel = ResourceManager::Load<RawModel, true>(triggerEntity["Model"]["Resource"]);
|
|
||||||
triggerModelMat = Transform::ModelMatrix(triggerEntity);
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_OctreeOut.clear();
|
m_OctreeOut.clear();
|
||||||
m_Octree->ObjectsInSameRegion(*triggerBox, m_OctreeOut);
|
m_Octree->ObjectsInSameRegion(*triggerBox, m_OctreeOut);
|
||||||
|
|
||||||
@@ -32,17 +22,7 @@ void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapp
|
|||||||
if (colliderFitsInTrigger) {
|
if (colliderFitsInTrigger) {
|
||||||
completelyInsideBox = AABB::FromOriginSize((*triggerBox).Origin(), (*triggerBox).Size() - 2.0f * colliderBox.Size());
|
completelyInsideBox = AABB::FromOriginSize((*triggerBox).Origin(), (*triggerBox).Size() - 2.0f * colliderBox.Size());
|
||||||
}
|
}
|
||||||
|
if (colliderFitsInTrigger && Collision::AABBVsAABB(completelyInsideBox, colliderBox)) {
|
||||||
// We know the entity is inside the trigger box, but perhaps not the model yet.
|
|
||||||
Collision::Output out = triggerModel == nullptr
|
|
||||||
? Collision::Output::OutContained
|
|
||||||
: Collision::AABBvsTrianglesWContainment(
|
|
||||||
colliderBox,
|
|
||||||
triggerModel->Vertices(),
|
|
||||||
triggerModel->m_Indices,
|
|
||||||
triggerModelMat);
|
|
||||||
|
|
||||||
if (colliderFitsInTrigger && Collision::AABBVsAABB(completelyInsideBox, colliderBox) && out == Collision::Output::OutContained) {
|
|
||||||
// Entity is completely inside the trigger.
|
// Entity is completely inside the trigger.
|
||||||
// If it was only touching before, it is erased.
|
// If it was only touching before, it is erased.
|
||||||
m_EntitiesTouchingTrigger[triggerEntity].erase(colliderEntity);
|
m_EntitiesTouchingTrigger[triggerEntity].erase(colliderEntity);
|
||||||
@@ -52,8 +32,7 @@ void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapp
|
|||||||
completeSet.insert(colliderEntity);
|
completeSet.insert(colliderEntity);
|
||||||
publish<Events::TriggerEnter>(colliderEntity, triggerEntity);
|
publish<Events::TriggerEnter>(colliderEntity, triggerEntity);
|
||||||
}
|
}
|
||||||
continue;
|
} else {
|
||||||
} else if (out != Collision::Output::OutSeparated) {
|
|
||||||
// Entity is only touching the trigger.
|
// Entity is only touching the trigger.
|
||||||
auto& touchSet = m_EntitiesTouchingTrigger[triggerEntity];
|
auto& touchSet = m_EntitiesTouchingTrigger[triggerEntity];
|
||||||
auto& completeSet = m_EntitiesCompletelyInTrigger[triggerEntity];
|
auto& completeSet = m_EntitiesCompletelyInTrigger[triggerEntity];
|
||||||
@@ -68,17 +47,17 @@ void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapp
|
|||||||
touchSet.insert(colliderEntity);
|
touchSet.insert(colliderEntity);
|
||||||
}
|
}
|
||||||
// Else, it was touching the trigger last frame too and nothing is done.
|
// Else, it was touching the trigger last frame too and nothing is done.
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Entity is not touching the trigger,
|
||||||
|
// Throw event if it was previously.
|
||||||
|
if (throwLeaveIfWasInTrigger(m_EntitiesTouchingTrigger[triggerEntity], colliderEntity, triggerEntity)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// This only occurs if the entity was completely inside the trigger one frame,
|
||||||
|
// then completely outside the trigger, e.g. when dying and respawning.
|
||||||
|
throwLeaveIfWasInTrigger(m_EntitiesCompletelyInTrigger[triggerEntity], colliderEntity, triggerEntity);
|
||||||
}
|
}
|
||||||
// Only get here if entity is not touching the trigger,
|
|
||||||
// throw event if it was touching previously.
|
|
||||||
if (throwLeaveIfWasInTrigger(m_EntitiesTouchingTrigger[triggerEntity], colliderEntity, triggerEntity)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// This only occurs if the entity was completely inside the trigger one frame,
|
|
||||||
// then completely outside the trigger, e.g. when dying and respawning.
|
|
||||||
throwLeaveIfWasInTrigger(m_EntitiesCompletelyInTrigger[triggerEntity], colliderEntity, triggerEntity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void EntityWrapper::AttachComponent(const char* componentName)
|
|||||||
|
|
||||||
EntityWrapper EntityWrapper::Parent()
|
EntityWrapper EntityWrapper::Parent()
|
||||||
{
|
{
|
||||||
if (this->World == nullptr || this->ID == EntityID_Invalid) {
|
if (!Valid()) {
|
||||||
return EntityWrapper::Invalid;
|
return EntityWrapper::Invalid;
|
||||||
} else {
|
} else {
|
||||||
return EntityWrapper(this->World, this->World->GetParent(this->ID));
|
return EntityWrapper(this->World, this->World->GetParent(this->ID));
|
||||||
@@ -36,6 +36,10 @@ EntityWrapper EntityWrapper::Parent()
|
|||||||
|
|
||||||
EntityWrapper EntityWrapper::FirstParentByName(const std::string& parentEntityName)
|
EntityWrapper EntityWrapper::FirstParentByName(const std::string& parentEntityName)
|
||||||
{
|
{
|
||||||
|
if (!Valid()) {
|
||||||
|
return EntityWrapper::Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
EntityWrapper entity = *this;
|
EntityWrapper entity = *this;
|
||||||
while (entity.Parent().Valid()) {
|
while (entity.Parent().Valid()) {
|
||||||
entity = entity.Parent();
|
entity = entity.Parent();
|
||||||
@@ -48,6 +52,10 @@ EntityWrapper EntityWrapper::FirstParentByName(const std::string& parentEntityNa
|
|||||||
|
|
||||||
EntityWrapper EntityWrapper::FirstChildByName(const std::string& name)
|
EntityWrapper EntityWrapper::FirstChildByName(const std::string& name)
|
||||||
{
|
{
|
||||||
|
if (!Valid()) {
|
||||||
|
return EntityWrapper::Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
return firstChildByNameRecursive(name, this->ID);
|
return firstChildByNameRecursive(name, this->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +86,10 @@ EntityWrapper EntityWrapper::FirstLevelChildByName(const std::string& name)
|
|||||||
|
|
||||||
EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& componentType)
|
EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& componentType)
|
||||||
{
|
{
|
||||||
|
if (!Valid()) {
|
||||||
|
return EntityWrapper::Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
EntityWrapper entity = *this;
|
EntityWrapper entity = *this;
|
||||||
while (entity.Parent().Valid()) {
|
while (entity.Parent().Valid()) {
|
||||||
entity = entity.Parent();
|
entity = entity.Parent();
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
|
|||||||
Enable();
|
Enable();
|
||||||
} else {
|
} else {
|
||||||
Disable();
|
Disable();
|
||||||
m_EventBroker->Publish(Events::UnlockMouse());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "Network/Client.h"
|
#include "Network/Client.h"
|
||||||
#include "Network/EPlayerDisconnected.h"
|
|
||||||
using namespace boost::asio::ip;
|
using namespace boost::asio::ip;
|
||||||
|
|
||||||
Client::Client(World* world, EventBroker* eventBroker)
|
Client::Client(World* world, EventBroker* eventBroker)
|
||||||
@@ -225,7 +224,7 @@ void Client::parseServerlist(Packet& packet)
|
|||||||
void Client::parseKick()
|
void Client::parseKick()
|
||||||
{
|
{
|
||||||
LOG_WARNING("You have been kicked from the server.");
|
LOG_WARNING("You have been kicked from the server.");
|
||||||
disconnect();
|
m_IsConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parseSpawnEvents()
|
void Client::parseSpawnEvents()
|
||||||
@@ -465,10 +464,6 @@ void Client::disconnect()
|
|||||||
Packet packet(MessageType::Disconnect, m_SendPacketID);
|
Packet packet(MessageType::Disconnect, m_SendPacketID);
|
||||||
m_Reliable.Send(packet);
|
m_Reliable.Send(packet);
|
||||||
m_Reliable.Disconnect();
|
m_Reliable.Disconnect();
|
||||||
Events::PlayerDisconnected e;
|
|
||||||
e.Entity = m_LocalPlayer.ID;
|
|
||||||
e.PlayerID = -1;
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
createMainMenu();
|
createMainMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1232,7 +1232,7 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob
|
|||||||
} else {
|
} else {
|
||||||
frameBones = modelJob->Skeleton->GetTPose();
|
frameBones = modelJob->Skeleton->GetTPose();
|
||||||
}
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (lastShader != m_FillDepthStencilBufferProgram->GetHandle()) {
|
if (lastShader != m_FillDepthStencilBufferProgram->GetHandle()) {
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ DrawFinalPassState::DrawFinalPassState(GLuint frameBuffer)
|
|||||||
Enable(GL_DEPTH_TEST);
|
Enable(GL_DEPTH_TEST);
|
||||||
DepthMask(GL_TRUE);
|
DepthMask(GL_TRUE);
|
||||||
Enable(GL_CULL_FACE);
|
Enable(GL_CULL_FACE);
|
||||||
Enable(GL_ALPHA_TEST);
|
|
||||||
AlphaFunc(GL_GEQUAL, 0.05f);
|
|
||||||
// Enable(GL_STENCIL_TEST);
|
// Enable(GL_STENCIL_TEST);
|
||||||
// StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
// StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||||
// StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
// StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||||
|
|||||||
@@ -108,10 +108,10 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
//change what model is displaying (change all in case 2 capturepoints has been captured on the same frame)
|
//change what model is displaying (change all in case 2 capturepoints has been captured on the same frame)
|
||||||
for (int i = 0; i < m_NumberOfCapturePoints; i++) {
|
for (int i = 0; i < m_NumberOfCapturePoints; i++) {
|
||||||
auto owner = (int)m_CapturePointNumberToEntityMap[i]["Team"]["Team"];
|
auto owner = (int)m_CapturePointNumberToEntityMap[i]["Team"]["Team"];
|
||||||
if (m_CapturePointNumberToEntityMap[i].FirstChildByName("Red").Valid()) {
|
if (m_CapturePointNumberToEntityMap[i].FirstChildByName("Red").ID != EntityID_Invalid) {
|
||||||
ChangeCapturePointModelsVisibility(m_CapturePointNumberToEntityMap[i].FirstChildByName("Red"), owner == redTeam);
|
(bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Red")["Model"]["Visible"] = owner == redTeam ? true : false;
|
||||||
ChangeCapturePointModelsVisibility(m_CapturePointNumberToEntityMap[i].FirstChildByName("Blue"), owner == blueTeam);
|
(bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Blue")["Model"]["Visible"] = owner == blueTeam ? true : false;
|
||||||
ChangeCapturePointModelsVisibility(m_CapturePointNumberToEntityMap[i].FirstChildByName("Spectator"), owner == spectatorTeam);
|
(bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Spectator")["Model"]["Visible"] = owner == spectatorTeam ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//save the next cap points and publish the captured event
|
//save the next cap points and publish the captured event
|
||||||
@@ -232,19 +232,6 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CapturePointSystem::ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner) {
|
|
||||||
(bool&)capturePointModels["Model"]["Visible"] = isOwner;
|
|
||||||
for (auto& capModel : capturePointModels.ChildrenWithComponent("Transform"))
|
|
||||||
{
|
|
||||||
if (capModel.HasComponent("Model")) {
|
|
||||||
(bool&)capModel["Model"]["Visible"] = isOwner;
|
|
||||||
}
|
|
||||||
if (capModel.HasComponent("PointLight")) {
|
|
||||||
(bool&)capModel["PointLight"]["Visible"] = isOwner;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CapturePointSystem::OnTriggerTouch(const Events::TriggerTouch& e)
|
bool CapturePointSystem::OnTriggerTouch(const Events::TriggerTouch& e)
|
||||||
{
|
{
|
||||||
//personEntered = e.Entity, thingEntered = e.Trigger
|
//personEntered = e.Entity, thingEntered = e.Trigger
|
||||||
|
|||||||
@@ -264,11 +264,6 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
size = glm::vec3(1.f, 1.f, 1.f);
|
size = glm::vec3(1.f, 1.f, 1.f);
|
||||||
} else {
|
} else {
|
||||||
size = glm::vec3(1.f, 1.6f, 1.f);
|
size = glm::vec3(1.f, 1.6f, 1.f);
|
||||||
if (controller->CrouchingLastFrame() && isOnGround) {
|
|
||||||
// The collision should resolve this anyway, but
|
|
||||||
// this is more reliable, since the box gets larger.
|
|
||||||
((glm::vec3&)cTransform["Position"]).y += 0.3f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ SpectatorCameraSystem::SpectatorCameraSystem(SystemParams params)
|
|||||||
, m_PickedTeam(-1)
|
, m_PickedTeam(-1)
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &SpectatorCameraSystem::OnInputCommand);
|
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &SpectatorCameraSystem::OnInputCommand);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EDisconnect, &SpectatorCameraSystem::OnDisconnect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectatorCameraSystem::Update(double dt)
|
void SpectatorCameraSystem::Update(double dt)
|
||||||
@@ -88,17 +87,4 @@ bool SpectatorCameraSystem::OnInputCommand(const Events::InputCommand& e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpectatorCameraSystem::OnDisconnect(const Events::PlayerDisconnected& e)
|
|
||||||
{
|
|
||||||
// If local player gets disconnected, they should be set to
|
|
||||||
// the spectator camera next time a map loads that has one.
|
|
||||||
if (e.Entity == LocalPlayer.ID) {
|
|
||||||
m_CamSetToTeamPick = false;
|
|
||||||
// They will also be set to menu, so unlock mouse just in case they were in game with locked mouse.
|
|
||||||
Events::UnlockMouse unlock;
|
|
||||||
m_EventBroker->Publish(unlock);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -190,60 +190,50 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi
|
|||||||
magAmmo -= 1;
|
magAmmo -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int numPellets = cWeapon["NumPellets"];
|
// We can't really do any valuable calculations without a valid camera
|
||||||
float spreadAngle = cWeapon["SpreadAngle"];
|
if (!m_CurrentCamera.Valid()) {
|
||||||
std::uniform_real_distribution<float> randomSpreadAngle(-spreadAngle, spreadAngle);
|
return;
|
||||||
|
|
||||||
// Calculate pellet angles
|
|
||||||
// HACK: Random for now?
|
|
||||||
// TODO: Make distribution even for each quadrant
|
|
||||||
std::vector<glm::vec2> pelletAngles;
|
|
||||||
for (int i = 0; i < numPellets; i++) {
|
|
||||||
pelletAngles.push_back(glm::vec2(randomSpreadAngle(m_RandomEngine), randomSpreadAngle(m_RandomEngine)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double pelletDamage = (double)cWeapon["BaseDamage"] / numPellets;
|
int numPellets = cWeapon["NumPellets"];
|
||||||
|
|
||||||
|
// Create a spread pattern
|
||||||
|
std::vector<glm::vec2> pattern;
|
||||||
|
// The first pellet is always centered
|
||||||
|
pattern.push_back(glm::vec2(0, 0));
|
||||||
|
// Any additional pellets form circles around the middle
|
||||||
|
int numOuterPellets = numPellets - 1;
|
||||||
|
float angleIncrement = glm::two_pi<float>() / numOuterPellets;
|
||||||
|
for (int i = 0; i < numOuterPellets; ++i) {
|
||||||
|
float angle = angleIncrement * i;
|
||||||
|
glm::vec2 pellet = glm::vec2(glm::cos(angle), glm::sin(angle));
|
||||||
|
pattern.push_back(pellet);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deal damage (clientside)
|
||||||
|
dealDamage(cWeapon, wi, pattern);
|
||||||
|
|
||||||
|
// Spawn tracers
|
||||||
|
spawnTracers(cWeapon, wi, pattern);
|
||||||
|
|
||||||
// View punch
|
// View punch
|
||||||
if (IsClient) {
|
//if (IsClient) {
|
||||||
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
|
// EntityWrapper camera = wi.Player.FirstChildByName("Camera");
|
||||||
if (camera.Valid()) {
|
// if (camera.Valid()) {
|
||||||
glm::vec3& cameraOrientation = camera["Transform"]["Orientation"];
|
// glm::vec3& cameraOrientation = camera["Transform"]["Orientation"];
|
||||||
float viewPunch = cWeapon["ViewPunch"];
|
// float viewPunch = cWeapon["ViewPunch"];
|
||||||
float maxTravelAngle = cWeapon["MaxTravelAngle"];
|
// float maxTravelAngle = cWeapon["MaxTravelAngle"];
|
||||||
float& currentTravel = cWeapon["CurrentTravel"];
|
// float& currentTravel = cWeapon["CurrentTravel"];
|
||||||
if (currentTravel < maxTravelAngle) {
|
// if (currentTravel < maxTravelAngle) {
|
||||||
float change = viewPunch;
|
// float change = viewPunch;
|
||||||
if (currentTravel + change > maxTravelAngle) {
|
// if (currentTravel + change > maxTravelAngle) {
|
||||||
change = maxTravelAngle - currentTravel;
|
// change = maxTravelAngle - currentTravel;
|
||||||
}
|
// }
|
||||||
cameraOrientation.x += change;
|
// cameraOrientation.x += change;
|
||||||
currentTravel += change;
|
// currentTravel += change;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Tracers
|
|
||||||
EntityWrapper weaponModelEntity;
|
|
||||||
if (wi.Player == LocalPlayer) {
|
|
||||||
weaponModelEntity = wi.FirstPersonEntity;
|
|
||||||
} else {
|
|
||||||
weaponModelEntity = wi.ThirdPersonEntity;
|
|
||||||
}
|
|
||||||
if (weaponModelEntity.Valid()) {
|
|
||||||
EntityWrapper spawner = weaponModelEntity.FirstChildByName("WeaponMuzzle");
|
|
||||||
for (auto& angles : pelletAngles) {
|
|
||||||
glm::vec3 direction = Transform::AbsoluteOrientation(spawner) * glm::quat(glm::vec3(angles, 0.f)) * glm::vec3(0, 0, -1);
|
|
||||||
float distance = traceRayDistance(Transform::AbsolutePosition(spawner), direction);
|
|
||||||
EntityWrapper ray = SpawnerSystem::Spawn(spawner);
|
|
||||||
((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f);
|
|
||||||
glm::vec3& orientation = ray["Transform"]["Orientation"];
|
|
||||||
orientation.x += angles.x;
|
|
||||||
orientation.y += angles.y;
|
|
||||||
glm::vec3 trajectory = direction * distance;
|
|
||||||
dealDamage(cWeapon, wi, direction, pelletDamage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Play animation
|
// Play animation
|
||||||
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Fire");
|
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Fire");
|
||||||
@@ -255,7 +245,35 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi
|
|||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage)
|
void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& wi, std::vector<glm::vec2> pattern)
|
||||||
|
{
|
||||||
|
EntityWrapper muzzle = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzle");
|
||||||
|
if (!muzzle.Valid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float spreadAngle = glm::radians((float)cWeapon["SpreadAngle"]);
|
||||||
|
|
||||||
|
for (auto& pellet : pattern) {
|
||||||
|
glm::quat pelletRotation = glm::quat(Transform::AbsoluteOrientationEuler(wi.Player.FirstChildByName("Camera"))) * glm::quat(glm::vec3(pellet.y, pellet.x, 0) * spreadAngle);
|
||||||
|
glm::vec3 origin = Transform::AbsolutePosition(wi.Player.FirstChildByName("Camera"));
|
||||||
|
glm::vec3 direction = pelletRotation * glm::vec3(0, 0, -1);
|
||||||
|
float distance = traceRayDistance(origin, direction);
|
||||||
|
EntityWrapper ray = SpawnerSystem::Spawn(muzzle);
|
||||||
|
if (ray.Valid()) {
|
||||||
|
ComponentWrapper cTransform = ray["Transform"];
|
||||||
|
glm::vec3& position = cTransform["Position"];
|
||||||
|
glm::vec3& orientation = cTransform["Orientation"];
|
||||||
|
glm::vec3& scale = cTransform["Scale"];
|
||||||
|
|
||||||
|
position = Transform::AbsolutePosition(wi.Player.FirstChildByName("Camera"));
|
||||||
|
orientation = glm::eulerAngles(pelletRotation);
|
||||||
|
scale.z = distance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, const std::vector<glm::vec2>& pattern)
|
||||||
{
|
{
|
||||||
// Only deal damage client side
|
// Only deal damage client side
|
||||||
if (!IsClient) {
|
if (!IsClient) {
|
||||||
@@ -271,47 +289,76 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w
|
|||||||
if (!wi.Player.Valid()) {
|
if (!wi.Player.Valid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 maxRange = direction * 2.f;
|
// Convert the spread angle to screen coordinates, taking FOV into account
|
||||||
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
|
Rectangle res = m_Renderer->GetViewportSize();
|
||||||
glm::vec3 cameraPosition = Transform::AbsolutePosition(camera);
|
float spreadAngle = glm::radians((float)cWeapon["SpreadAngle"]);
|
||||||
if (!camera.Valid()) {
|
float nearClip = (double)m_CurrentCamera["Camera"]["NearClip"];
|
||||||
return;
|
float farClip = (double)m_CurrentCamera["Camera"]["FarClip"];
|
||||||
}
|
float yFOV = glm::radians((double)m_CurrentCamera["Camera"]["FOV"]);
|
||||||
Rectangle screenResolution = m_Renderer->GetViewportSize();
|
//float yRefFOV = glm::radians(59.f);
|
||||||
glm::vec2 centerScreen = glm::vec2(screenResolution.Width / 2, screenResolution.Height / 2);
|
//float yRef = glm::tan(yRefFOV) * nearClip;
|
||||||
glm::vec2 screenCoords = cameraFromEntity(m_CurrentCamera).WorldToScreen(cameraPosition + maxRange, m_Renderer->GetViewportSize());
|
//float yRatio = yRef / (glm::tan(yFOV) * nearClip);
|
||||||
PickData pickData = m_Renderer->Pick(centerScreen + screenCoords);
|
//float yMax = (yRatio / 2.f) * spreadAngle * (res.Height / 2.f);
|
||||||
EntityWrapper victim(m_World, pickData.Entity);
|
float yRefFOV = glm::radians(59.f);
|
||||||
if (!victim.Valid()) {
|
float yRef = glm::tan(yRefFOV) * nearClip;
|
||||||
return;
|
float yRatio = yRef / (glm::tan(yFOV) * nearClip);
|
||||||
|
float yMax = yRatio * (glm::tan(spreadAngle) * farClip);
|
||||||
|
|
||||||
|
LOG_DEBUG("Ratio: %f", yRatio);
|
||||||
|
LOG_DEBUG("fatClip: %f", farClip);
|
||||||
|
LOG_DEBUG("yMax: %f", yMax);
|
||||||
|
double pelletDamage = (double)cWeapon["BaseDamage"] / pattern.size();
|
||||||
|
|
||||||
|
// Pick!
|
||||||
|
std::unordered_map<EntityWrapper, double> damageSum;
|
||||||
|
glm::vec2 screenCenter(res.Width / 2.f, res.Height / 2.f);
|
||||||
|
for (auto& pellet : pattern) {
|
||||||
|
glm::vec2 pickCoord = screenCenter + (pellet * glm::vec2(yMax, yMax));
|
||||||
|
PickData pick = m_Renderer->Pick(pickCoord);
|
||||||
|
|
||||||
|
EntityWrapper victim(m_World, pick.Entity);
|
||||||
|
if (!victim.Valid()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Temp hit decal
|
||||||
|
EntityWrapper hit = ResourceManager::Load<EntityFile>("Schema/Entities/HitTest.xml")->MergeInto(m_World);
|
||||||
|
hit["Transform"]["Position"] = pick.Position;
|
||||||
|
|
||||||
|
// Don't let us shoot ourselves in the foot somehow
|
||||||
|
if (victim == LocalPlayer) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only care about players being hit
|
||||||
|
if (!victim.HasComponent("Player")) {
|
||||||
|
victim = victim.FirstParentWithComponent("Player");
|
||||||
|
if (!victim.Valid()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for friendly fire
|
||||||
|
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) {
|
||||||
|
// TODO: Ammo sharing
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
damageSum[victim] += pelletDamage;
|
||||||
|
((glm::vec3&)hit["Model"]["Color"]).b = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't let us shoot ourselves in the foot somehow
|
// Deal damage!
|
||||||
if (victim == LocalPlayer) {
|
for (auto& kv : damageSum) {
|
||||||
return;
|
// Deal damage!
|
||||||
|
Events::PlayerDamage ePlayerDamage;
|
||||||
|
ePlayerDamage.Inflictor = wi.Player;
|
||||||
|
ePlayerDamage.Victim = kv.first;
|
||||||
|
ePlayerDamage.Damage = kv.second;
|
||||||
|
m_EventBroker->Publish(ePlayerDamage);
|
||||||
|
LOG_DEBUG("Dealt %f damage to #%i", kv.second, kv.first.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only care about players being hit
|
|
||||||
if (!victim.HasComponent("Player")) {
|
|
||||||
victim = victim.FirstParentWithComponent("Player");
|
|
||||||
}
|
|
||||||
if (!victim.Valid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for friendly fire
|
|
||||||
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deal damage!
|
|
||||||
Events::PlayerDamage ePlayerDamage;
|
|
||||||
ePlayerDamage.Inflictor = wi.Player;
|
|
||||||
ePlayerDamage.Victim = victim;
|
|
||||||
ePlayerDamage.Damage = damage;
|
|
||||||
m_EventBroker->Publish(ePlayerDamage);
|
|
||||||
LOG_DEBUG("Damage: %f", damage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefenderWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi)
|
bool DefenderWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi)
|
||||||
|
|||||||
Reference in New Issue
Block a user