mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
Merge pull request #152 from devZoGok/bf-148-raycast-lag
Bf 148 raycast lag
This commit is contained in:
+9
-3
@@ -403,7 +403,7 @@ namespace battleship{
|
||||
Vector3 endPos = screenToSpace(getCursorPos());
|
||||
|
||||
Vector3 rayDir = (endPos - camPos).norm();
|
||||
vector<RayCaster::CollisionResult> results = RayCaster::cast(camPos, rayDir, Map::getSingleton()->getNodeParent());
|
||||
vector<RayCaster::CollisionResult> results = RayCaster::cast(camPos, rayDir, Map::getSingleton()->getNodeParent(), 0, configData::DIST_FROM_RAY);
|
||||
|
||||
if(!results.empty()){
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
@@ -414,7 +414,7 @@ namespace battleship{
|
||||
Node *nodeParent = map->getNodeParent();
|
||||
|
||||
if(u->getType() == UnitType::UNDERWATER && nodeParent->getNumChildren() > 0){
|
||||
vector<RayCaster::CollisionResult> res = RayCaster::cast(Vector3(pos.x, 100, pos.z), Vector3(0, -1, 0), nodeParent->getChild(0));
|
||||
vector<RayCaster::CollisionResult> res = RayCaster::cast(Vector3(pos.x, 100, pos.z), Vector3(0, -1, 0), nodeParent->getChild(0), 0, configData::DIST_FROM_RAY);
|
||||
|
||||
Vector3 waterBodyPos = Vector3::VEC_ZERO;
|
||||
Vector3 cellSize = map->getCellSize();
|
||||
@@ -626,7 +626,13 @@ namespace battleship{
|
||||
depth += 0.05;
|
||||
|
||||
Vector3 startPos = Root::getSingleton()->getCamera()->getPosition();
|
||||
vector<RayCaster::CollisionResult> results = RayCaster::cast(startPos, (screenToSpace(getCursorPos()) - startPos).norm(), Map::getSingleton()->getNodeParent()->getChild(0));
|
||||
vector<RayCaster::CollisionResult> results = RayCaster::cast(
|
||||
startPos,
|
||||
(screenToSpace(getCursorPos()) - startPos).norm(),
|
||||
Map::getSingleton()->getNodeParent()->getChild(0),
|
||||
0,
|
||||
configData::DIST_FROM_RAY
|
||||
);
|
||||
|
||||
if(!results.empty())
|
||||
ufCtr->setPaintSelectRowStart(results[0].pos);
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ namespace battleship{
|
||||
using namespace gameBase;
|
||||
|
||||
const std::string DEFAULT_TEXTURE = "Textures/defaultTexture.jpg";
|
||||
const double camPanSpeed = .5, CAMERA_DISTANCE = 100, CAMERA_ZOOM_INCREMENT = 1, NUM_MAX_ZOOMS = 75, cellLength = 14, cellWidth = 14, cellDepth = 7;
|
||||
const int maxNumGroups = 10;
|
||||
const double camPanSpeed = .5, CAMERA_DISTANCE = 100, CAMERA_ZOOM_INCREMENT = 1, cellLength = 14, cellWidth = 14, cellDepth = 7, DIST_FROM_RAY = 20;
|
||||
const int maxNumGroups = 10, NUM_MAX_ZOOMS = 75;
|
||||
const vb01::u32 IMPASS_NODE_VAL = 65535;
|
||||
|
||||
const static int numAppStates = 4;
|
||||
|
||||
Vendored
+1
-1
Submodule external/gameBase updated: e71e5ce63e...59451791f3
Vendored
+1
-1
Submodule external/vb01 updated: 4682085884...6077cf9cde
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "gameObjectFrameController.h"
|
||||
#include "resourceDeposit.h"
|
||||
#include "defConfigs.h"
|
||||
#include "player.h"
|
||||
#include "game.h"
|
||||
#include "unit.h"
|
||||
@@ -118,7 +119,13 @@ namespace battleship{
|
||||
frame.update();
|
||||
|
||||
Vector3 startPos = Root::getSingleton()->getCamera()->getPosition();
|
||||
vector<RayCaster::CollisionResult> results = RayCaster::cast(startPos, (screenToSpace(getCursorPos()) - startPos).norm(), Map::getSingleton()->getNodeParent()->getChild(0));
|
||||
vector<RayCaster::CollisionResult> results = RayCaster::cast(
|
||||
startPos,
|
||||
(screenToSpace(getCursorPos()) - startPos).norm(),
|
||||
Map::getSingleton()->getNodeParent()->getChild(0),
|
||||
0,
|
||||
configData::DIST_FROM_RAY
|
||||
);
|
||||
|
||||
if(results.empty()) return;
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace battleship{
|
||||
for(int i = 0; i < numVertCells; i++)
|
||||
for(int j = 0; j < numHorCells; j++){
|
||||
Vector3 rayPos = startPos + Vector3(cellSize.x * j, 100, cellSize.z * i);
|
||||
vector<RayCaster::CollisionResult> res = RayCaster::cast(rayPos, -Vector3::VEC_J, terrainNode->getChild(0), 0, 4);
|
||||
vector<RayCaster::CollisionResult> res = RayCaster::cast(rayPos, -Vector3::VEC_J, terrainNode->getChild(0), 0, configData::DIST_FROM_RAY);
|
||||
|
||||
if(res.empty()){
|
||||
RayCaster::CollisionResult r;
|
||||
@@ -627,7 +627,13 @@ namespace battleship{
|
||||
Vector2 cursorPos = getCursorPos();
|
||||
Vector3 endPos = screenToSpace(cursorPos);
|
||||
|
||||
vector<RayCaster::CollisionResult> results = RayCaster::cast(startPos, (endPos - startPos).norm(), Root::getSingleton()->getRootNode());
|
||||
vector<RayCaster::CollisionResult> results = RayCaster::cast(
|
||||
startPos,
|
||||
(endPos - startPos).norm(),
|
||||
Root::getSingleton()->getRootNode(),
|
||||
0,
|
||||
configData::DIST_FROM_RAY
|
||||
);
|
||||
|
||||
if(cursorPos.y < GameManager::getSingleton()->getHeight() - mapEditor->getGuiThreshold()){
|
||||
bool push = !results.empty();
|
||||
|
||||
Reference in New Issue
Block a user