added drawline for raycast
This commit is contained in:
parent
89de721187
commit
130dff16d4
@ -51,6 +51,7 @@ public:
|
|||||||
SparrowRenderer* getRenderer() const {return m_renderer;}
|
SparrowRenderer* getRenderer() const {return m_renderer;}
|
||||||
btDiscreteDynamicsWorld* getPhysics() const {return m_world;}
|
btDiscreteDynamicsWorld* getPhysics() const {return m_world;}
|
||||||
SparrowShell* getShell() const {return m_sparrowshell;}
|
SparrowShell* getShell() const {return m_sparrowshell;}
|
||||||
|
PhysicsDebugNode* getPhysicsDebug() const {return m_physicsDebugNode;}
|
||||||
GuiTools* getGuiTools() const {return m_guiTools;}
|
GuiTools* getGuiTools() const {return m_guiTools;}
|
||||||
SceneTree* getScene() const;
|
SceneTree* getScene() const;
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include <glm/ext.hpp>
|
#include <glm/ext.hpp>
|
||||||
|
|
||||||
|
#include "scene/physicsdebugnode.h"
|
||||||
|
|
||||||
#include "scenetree.h"
|
#include "scenetree.h"
|
||||||
#include "lightnode.h"
|
#include "lightnode.h"
|
||||||
#include <SFML/System.hpp>
|
#include <SFML/System.hpp>
|
||||||
@ -222,6 +224,11 @@ void PlayerCharacterNode::update()
|
|||||||
getEngine().getPhysics()->rayTest(start_front, end_front, RayCallback_front);
|
getEngine().getPhysics()->rayTest(start_front, end_front, RayCallback_front);
|
||||||
getEngine().getPhysics()->rayTest(start_back, end_back, RayCallback_back);
|
getEngine().getPhysics()->rayTest(start_back, end_back, RayCallback_back);
|
||||||
|
|
||||||
|
PhysicsDebugNode* pdnode= getEngine().getPhysicsDebug();
|
||||||
|
if (pdnode != nullptr){
|
||||||
|
pdnode->drawLine(start_front,end_front,btVector3(1,0,1));
|
||||||
|
pdnode->drawLine(start_back,end_back,btVector3(1,0,1));
|
||||||
|
}
|
||||||
float controlRatio = 0.2f; // 1 = total control, 0 = no control, can be seen as a slipperiness factor
|
float controlRatio = 0.2f; // 1 = total control, 0 = no control, can be seen as a slipperiness factor
|
||||||
|
|
||||||
if(RayCallback_back.hasHit()){
|
if(RayCallback_back.hasHit()){
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "guitools.h"
|
#include "guitools.h"
|
||||||
#include "scene/scenetree.h"
|
#include "scene/scenetree.h"
|
||||||
#include "scene/playercharacternode.h"
|
#include "scene/playercharacternode.h"
|
||||||
|
#include "scene/physicsdebugnode.h"
|
||||||
|
|
||||||
#include <SparrowRenderer/parametricmesh.h>
|
#include <SparrowRenderer/parametricmesh.h>
|
||||||
#include <SparrowRenderer/pbrmaterial.h>
|
#include <SparrowRenderer/pbrmaterial.h>
|
||||||
@ -76,6 +77,9 @@ void ScenePicker::pick()
|
|||||||
btVector3 end = start;
|
btVector3 end = start;
|
||||||
end += btVector3(start.x() + dir_cam.x, start.y() + dir_cam.y, start.z() + dir_cam.z);
|
end += btVector3(start.x() + dir_cam.x, start.y() + dir_cam.y, start.z() + dir_cam.z);
|
||||||
btCollisionWorld::ClosestRayResultCallback RayCallback(start, end);
|
btCollisionWorld::ClosestRayResultCallback RayCallback(start, end);
|
||||||
|
PhysicsDebugNode* pdnode= getEngine().getPhysicsDebug();
|
||||||
|
if (pdnode != nullptr)
|
||||||
|
pdnode->drawLine(start,end,btVector3(1,0,1));
|
||||||
getEngine().getPhysics()->rayTest(start,end,RayCallback);
|
getEngine().getPhysics()->rayTest(start,end,RayCallback);
|
||||||
|
|
||||||
m_pickSucceeded = RayCallback.hasHit();
|
m_pickSucceeded = RayCallback.hasHit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user