Jump to content

Search the Community

Showing results for tags 'C++'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Blogs

  • Development Blog
  • Canardian's Blog
  • Beyond Civilization Blog Ext
  • Tyler's Blog
  • macklebee's Blog
  • B-Byrnes' Blog
  • Marleys Ghost's Blog
  • omid3098's Blog
  • Richardsimpo123456's Blog
  • DJDD's Blog
  • Rick's Blog
  • --
  • xtreampb's Blog
  • Economically Disadvantaged
  • klepto2's Blog
  • Old Blog
  • Chris Paulson's Blog
  • Davaris' Blog
  • nil
  • Rekindled Phoenix's Blog
  • Flexman's Blog
  • Kattemaksu Online
  • Marcousik's Creations Blog
  • EVE LBS Studio
  • Rendering puzzles
  • Screen Size Utility
  • Niosop's Blog
  • 1299 RTS Game Project
  • Blitzbat's Blog
  • gordonramp's Blog
  • Andy Gilbert's Blog
  • Marcus' Blog
  • JornAggror Blog
  • diedir's Blog
  • wayneg's Blog
  • Masterxilo's Blog
  • Dave Lee's Blog
  • peubuy's blog
  • OD Arts -Leadwerks Blog
  • The progression......
  • Ultra Software Company Blog
  • The Progression
  • Pancake's Blog
  • Test Blog
  • BLaBZ Blog
  • Pure³d's Blog
  • dreamhead Blog
  • RVL's Blog
  • DB's Blog
  • Toxin Games Development Blog
  • CombatHelo Blog (RSS Import)
  • Foolish's Blog
  • ZioRed's Corner
  • Toxin Games Twitter
  • Shard - Third Initiative
  • Shard's Blog
  • Soamp's Blog
  • Soamp's Blog
  • Laurens' Blog
  • JT`s warehouse district
  • Kennar's Blog
  • KiteFuchs' Blog
  • KiteFuchs' Blog
  • Rachel's Dev-Blog
  • Eagle's Blog
  • zaphos' Blog
  • please delete this blog
  • Afke's Blog
  • Richard Simpson
  • knowledgegranted's Blog
  • EdzUp(GD)'s Blog
  • aGameLife's Kelasel MMORPG Blog
  • tournamentdan's Blog
  • Beyond Civilization Blog
  • smashthewindow
  • AnniXa's Blog
  • AnniXa's Blog
  • Elemental Development
  • DigitalHax Blog
  • Aria's Blog
  • Strogg76's Blog
  • Clackdor's Blog
  • Leadwerks Project Status
  • simpleprogrammer's Blog
  • Pathfinding in LE.2.x
  • Naughty Alien's Blog
  • smashthewindow's Blog
  • Ali Salehi's Blog
  • Jardar's Blog
  • Chris Vossen's Development Blog
  • Scarlet Thread Studios' Blog
  • Kronos' Blog
  • Benton's Blog
  • ChrisV's Blog
  • tjheldna's Blog
  • shadmar's Blog
  • 3D Masons, LLC
  • Andy Gilbert's Enviro Models
  • ParaToxic's Blog
  • NarkLord's Blog
  • ChrisMAN's Blog
  • ChrisMAN's Blog
  • CGMan's Blog
  • The Game
  • Chris Tutorials
  • Leadwerks 3 Experience
  • An Alien Saga
  • klepto2 & Leadwerks 3
  • Inside the mind of eternal insomniac
  • josk's Blog
  • Shader Development in Leadwerks 3.1
  • 3D Coat : Column game making of
  • Einlander's Blog
  • Ginger George's Blog
  • I have a problem
  • Michael_J's Blog
  • nasamydifol's Blog
  • Digman's Blog
  • noesisGUI
  • SavageDogg38's Blog
  • Built from Ruins
  • Remaining Days
  • test_external_blog
  • The Hunt For Food Blog
  • Crazy Minnow Studio
  • CrazyMinnowStudio
  • Guppy's Blog
  • Playing Online
  • Evayr's Blog
  • DerRidda's Blog
  • Karl's Blog
  • whiterabbit's Blog
  • Tinyboss Games
  • abendkleider's Blog
  • sacguccireplica's Blog
  • Arena
  • Imchasinyou's Blog
  • xtom's Blog
  • Lua is better than you think.
  • mdgunn's Blog
  • Crime Closer
  • lxFirebal69xl's Blog
  • Wedmer's Blog
  • Lockdown, going forward.
  • Pump-Action Captain
  • Igor's Blog
  • Dead Anyway
  • Runenrise and more
  • reepblue's Blog
  • Slippy's Corner
  • LUA Musings
  • severjack's Blog
  • mikeporter's Blog
  • miko93's Blog
  • Megalocerous' Blog
  • lxFirebal69xl's Blog
  • aiaf's Blog
  • Lostghbear's Blog
  • echo $BLOG_NAME > blog_title.tmpl
  • johnadam111's Blog
  • Dwarf Beard
  • burgelkat's Blog
  • Charrua's Blog
  • peterpaul's Blog
  • joshmathews' Blog
  • Martin Kearl's Blog
  • Brutile's blog
  • tipforeveryone's Blog
  • Glushchenko Blog
  • Express Lab Games Blog
  • Blueapples' Blog
  • DooMAGE's Blog
  • Structura devblog
  • UltraEngine - Experiences, add-ons and other Stuff
  • martyj's Blog
  • Dragonfreak's Blog
  • Brutile's Blog
  • assigmenthelp
  • Case Study Assignment Help
  • How to deal with bad grade ?
  • How to deal with bad grade ?
  • GameDev Blog
  • devcjohnson's Blog
  • devcjohnson's Blog
  • THE WHAT? Blog
  • The Demurian Scribe
  • GUI Editor
  • GUI Tutorial
  • noob_shaders
  • The Seventh World
  • Phodex Games Blog
  • Leadwerks VS Source 2
  • Work in Progress - Scifi PBR Media
  • [C++] First Player game start
  • The Blog of Yue
  • Snowboarding Development Blog
  • Ocean: Rendering in Leadwerks 4
  • Game Ready Maps
  • Ultra App Kit (Advanced Custom Widgets)
  • Poking around
  • SALVATIONLAND
  • Blender tutorials
  • Usefull Scripts & Components
  • Thirsty Panther
  • Direct Macro

Forums

  • Software
    • General Discussion
    • Programming
    • Game Artwork
    • Showcase
    • Suggestion Box
    • Bug Reports
  • Addons
    • Extensions & Plugins
    • Components
    • Addon Development
  • Platforms
    • Windows
    • Linux
    • macOS

Product Groups

  • Software

Categories

  • Tutorials
  • Games
  • Work in Progress

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location

  1. Here is how i made it possible to call C++ from LUA. I want to build Multiplayer game in Leadwerks. But i couldn't find networking libraries and threading libraries that would make it usable in Lua. So i build a Networking client in C++ with libcurl and libpthread . But i want to still use the Lua scripting on the prefabs since a lot of work is already done for me here. And also programming in Higher level languages is just faster. I decided to use the libtolua++ libraries, since this is already build into Leadwerks. I work on Ubuntu 15.04. Here the tolua++ libs are installed with: sudo apt-get install libtolua++5.1-dev The tolua++ program needs a pck file which shall contain the c++ like seudo code that is translated into lua classes. My package: $#include "shot.h" class ShotListener { ShotListener(); ~ShotListener(); void shot(Object* oEntity, float damage); float getHealth(Object* oEntity); }; I have made two functions. One to emit shots detected on the Entities from the Lua scripting. Another to get the current health status from C++ side. My actual ShotListener.h class looks like this: #pragma once #include "App.h" #include "Leadwerks.h" using namespace Leadwerks; class ShotListener { private: public: ShotListener(void) { } ~ShotListener(void){} void shot(Object* oEntity, float damage) { App *app = App::getInstance(); Entity * entity = (Entity*)oEntity; app->entityShot(entity, damage); return; } float getHealth(Object* oEntity) { App *app = App::getInstance(); Entity * entity = (Entity*)oEntity; float value = app->getEntityHealth(entity); return value; } }; As you can see i changed the default App class into a Singleton so that i can get the App object from the instances of ShotListener that is used from Lua. Having placed these two files in the same folder i ran the following function from the terminal: tolua++5.1 -o tolua_shot.cpp -H tolua_shot.h -n Shot shot.pkg This generated two files tolua_shot.cpp and tolua_shot.h that i included in my C++ project along with the shot.h file. This way i can do a self.shotListener = ShotListener:new() In the Script:Start() function in mu Lua objects and a self.shotListener:shot(self.entity, self.hits) When Hurt is called in the Lua object. After this i just had to sort out all the Segmentation error bugs because of multithreading. I forgot to mention that the ShotListener Lua also needs to be initialized in the main.cpp before app->Start() with the following: if (Interpreter::L==NULL) Interpreter::Reset(); tolua_ShotListener_open(Interpreter::L);
  2. Does any one know how to get a normal that will tell the general direction all the vertices of an object lay in? Like an average position, but as a normal... any one got any ideas?
  3. PickInfo.triangle returns -1 for me, and PickInfo.face is NULL. This is my code; Vec3 _mPos = window->GetMousePosition(); PickInfo _pickInfo; if (camera->Pick(_mPos.x, _mPos.y, _pickInfo, 0.01f, true) == true) { int _index = _pickInfo.triangle; auto _face = _pickInfo.face; } Is there a way to get this data?
  4. Is it possible to change a window between full-screen and windowed mode while it is running? Can the full-screen window be created and then set as the default, then the old window deleted? ?
  5. How can I check if the Steam Overlay is active? I can't see anything that looks relevant under the Steamworks class.
  6. I'm loading a few data files in c++ and have included these files in the publishing process (below) lod, data and strc are just binary files. lua, mat, mdl, phy, shader, tex, ttf, wav, ogg, mpd, cfg, lod, dat, strc Am I correct in saying that loading with ordinary commands like fopen_s() won't be able to access the encrypted files in data.zip? I can think of a few workarounds, like not including those files in the data.zip and adding them manually after publishing (won't be encrypted but it's not really needed for these I guess), or maybe using the internal Leadwerks file commands? Is there a way the publisher can change or retrieve the password used for encryption?
  7. I've started creating a large texture atlas for my terrain so that I can use more textures with less slots. The problem is the default mip-map generation creates bleeding on lower mip levels, and from what it says here, I need to create each mip-map separately and then combine them. Does anyone know of a way to manually set each mip-map level into a texture? Can I perhaps make a .dds texture with the mip-maps I want and will the editor then convert it to .tex format using those mip-maps?
  8. I can't seem to adjust the radius of my players character controller; physicsPivot->SetGravityMode(false); physicsPivot->SetDamping(0.0f, 0.0f); physicsPivot->SetPhysicsMode(Entity::CharacterPhysics); physicsPivot->SetCollisionType(COLLISION::PLAYER); physicsPivot->SetMass(1.0f); physicsPivot->charactercontroller->SetMaxSlope(80.0f); physicsPivot->charactercontroller->SetRadius(0.2f); float r = physicsPivot->charactercontroller->GetRadius(); The change is being detected in the variable "r" but in game there is no difference. Any suggestions?
  9. How does the PlayAnimation() time each frame? Is a speed of 1 dependent on FPS? If I have an animation that needs to run at 30 FPS, what would speed need to be?
  10. I'm aware the files will be needed in order to reproduce the problem but since they are quite large (~5GB) I wanted to first see if anyone else has come across crashes like this: Unhandled Exception at 0x00401DB1 : Fatal program exit requested I've attempted to debug the problem myself but as you'd expect with such little information it has been quite difficult. These crashes generally occur after about 10 - 15 minutes of play time either at the start or middle of a map.
  11. I use this code to create the normals for my terrain model. How would I create the Tangents and Bi-normals? I can't use the surface->UpdateTangentsAndBinormals() function, as I want the code to able to update normals for specific vertices only. How exactly do the tangents and bi-normals relate to the normal and how do they effect normal mapping? Vec3 _cPos = _getTerrainVertexPosition(x, z); Vec3 _lPos = _getTerrainVertexPosition(x - 1, z); Vec3 _rPos = _getTerrainVertexPosition(x + 1, z); Vec3 _uPos = _getTerrainVertexPosition(x, z + 1); Vec3 _dPos = _getTerrainVertexPosition(x, z - 1); //==================================================================================================// // TOP LEFT // //==================================================================================================// _U.x = _uPos.x - _lPos.x; _U.y = _uPos.y - _lPos.y; _U.z = _uPos.z - _lPos.z; _V.x = _cPos.x - _lPos.x; _V.y = _cPos.y - _lPos.y; _V.z = _cPos.z - _lPos.z; _topLeft.x = (_U.y * _V.z) - (_U.z * _V.y); _topLeft.y = (_U.z * _V.x) - (_U.x * _V.z); _topLeft.z = (_U.x * _V.y) - (_U.y * _V.x); //==================================================================================================// // TOP RIGHT // //==================================================================================================// _U.x = _cPos.x - _rPos.x; _U.y = _cPos.y - _rPos.y; _U.z = _cPos.z - _rPos.z; _V.x = _uPos.x - _rPos.x; _V.y = _uPos.y - _rPos.y; _V.z = _uPos.z - _rPos.z; _topRight.x = (_U.y * _V.z) - (_U.z * _V.y); _topRight.y = (_U.z * _V.x) - (_U.x * _V.z); _topRight.z = (_U.x * _V.y) - (_U.y * _V.x); //==================================================================================================// // BOTTOM LEFT // //==================================================================================================// _U.x = _dPos.x - _cPos.x; _U.y = _dPos.y - _cPos.y; _U.z = _dPos.z - _cPos.z; _V.x = _lPos.x - _cPos.x; _V.y = _lPos.y - _cPos.y; _V.z = _lPos.z - _cPos.z; _bottomLeft.x = (_U.y * _V.z) - (_U.z * _V.y); _bottomLeft.y = (_U.z * _V.x) - (_U.x * _V.z); _bottomLeft.z = (_U.x * _V.y) - (_U.y * _V.x); //==================================================================================================// // BOTTOM RIGHT // //==================================================================================================// _U.x = _rPos.x - _cPos.x; _U.y = _rPos.y - _cPos.y; _U.z = _rPos.z - _cPos.z; _V.x = _dPos.x - _cPos.x; _V.y = _dPos.y - _cPos.y; _V.z = _dPos.z - _cPos.z; _bottomRight.x = (_U.y * _V.z) - (_U.z * _V.y); _bottomRight.y = (_U.z * _V.x) - (_U.x * _V.z); _bottomRight.z = (_U.x * _V.y) - (_U.y * _V.x); _normal.x = (_topLeft.x + _topRight.x + _bottomLeft.x + _bottomRight.x) / 4.0f; _normal.y = (_topLeft.y + _topRight.y + _bottomLeft.y + _bottomRight.y) / 4.0f; _normal.z = (_topLeft.z + _topRight.z + _bottomLeft.z + _bottomRight.z) / 4.0f; //==================================================================================================// // NORMALIZE // //==================================================================================================// float _vectorLength = sqrt((_normal.x * _normal.x) + (_normal.y * _normal.y) + (_normal.z * _normal.z)); _normal.x = _normal.x / _vectorLength; _normal.y = _normal.y / _vectorLength; _normal.z = _normal.z / _vectorLength;
  12. I'm looking at the Actor class, when does ReceiveSignal() execute?
  13. Here's my attempt so far at making my own character controller. The reason for this is because I'm using multiple gravity directions in the same world and the current controller doesn't like gravity in any direction other than down the y axis. The problem I'm having is getting the controller to stay constrained to the up axis, when you move it with speed (shift key) you'll see that it drags across the terrain and bounces around. I'm not sure how to correctly use the joints settings to stop this kind of movement. Any help is appreciated. #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } float lookspeed = 0.1, looksmoothing = 0.5; Vec3 mousepos; float jointpos = 1; bool wireframe = false; Joint* joint; Entity* parent; Joint* k = nullptr; Entity* child; bool App::Start() { window = Leadwerks::Window::Create(); context = Context::Create(window); world = World::Create(); camera = Camera::Create(); camera->Move(0, 0, -4); Light* light = DirectionalLight::Create(); light->SetRotation(35, 35, 0); parent = Model::Box(); parent->SetColor(0.0, 0.0, 1.0); parent->SetMass(1); parent->SetGravityMode(false); child = Model::Box(); child->SetColor(1.0, 0.0, 0.0); child->SetShape(Shape::Box()); child->SetMass(1); child->SetGravityMode(true); k = Joint::Kinematic(0, 0, 0, parent); joint = Joint::Slider(0, 0, 0, 0, 1, 0, child, parent); joint->EnableLimits(); joint->SetLimits(-5, 5); joint->SetMotorSpeed(100); Model* mdl = Model::Load("Models\\Terrain.mdl"); mdl->SetScale(20, 20, 20); mdl->SetPosition(0, -3, 0); Shape* shp = Shape::PolyMesh(mdl->GetSurface(0)); mdl->SetShape(shp); mousepos = window->GetMousePosition(); window->SetMousePosition(context->GetWidth() / 2, context->GetHeight() / 2); return true; } bool App::Loop() { if (window->Closed() || window->KeyDown(Key::Escape)) return false; if (window->KeyHit(Key::F3) == true) { camera->GetDebugPhysicsMode() == true ? camera->SetDebugPhysicsMode(false) : camera->SetDebugPhysicsMode(true); } if (window->KeyHit(Key::F4) == true) { camera->GetDebugEntityBoxesMode() == true ? camera->SetDebugEntityBoxesMode(false) : camera->SetDebugEntityBoxesMode(true); } if (window->KeyHit(Key::F2) == true) { if (wireframe == true) { camera->SetDrawMode(0); wireframe = false; } else { camera->SetDrawMode(2); wireframe = true; } } float cx = Math::Round(context->GetWidth() / 2); float cy = Math::Round(context->GetHeight() / 2); Vec3 mpos = window->GetMousePosition(); window->SetMousePosition(cx, cy); mpos = mpos * looksmoothing + mousepos * (1 - looksmoothing); float dx = (mpos.x - cx) * lookspeed; float dy = (mpos.y - cy) * lookspeed; Vec3 camrot = camera->GetRotation(); camrot.x += dy; camrot.y += dx; camera->SetRotation(camrot); mousepos = mpos; float _time = Time::GetSpeed(); float camspeed = 0.2f * _time; if (window->KeyDown(Key::Shift) == true) { camspeed = camspeed * 5.0f; } if (window->KeyDown(Key::W) == true) { camera->Move(0, 0, camspeed); } else if (window->KeyDown(Key::S) == true) { camera->Move(0, 0, -camspeed); } if (window->KeyDown(Key::A) == true) { camera->Move(-camspeed, 0, 0); } else if (window->KeyDown(Key::D) == true) { camera->Move(camspeed, 0, 0); } if (window->KeyDown(Key::T) == true) { camera->Move(0, camspeed, 0); } else if (window->KeyDown(Key::G) == true) { camera->Move(0, -camspeed, 0); } Vec3 p = parent->GetPosition(true); Vec3 r = parent->GetRotation(true); float speed = 0.1f; if (window->KeyDown(Key::Shift) == true) { speed = 1.0f; } if (window->KeyDown(Key::Up)) { k->SetTargetPosition(p.x, p.y, p.z + speed); } if (window->KeyDown(Key::Down)) { k->SetTargetPosition(p.x, p.y, p.z - speed); } if (window->KeyDown(Key::Left)) { k->SetTargetPosition(p.x - speed, p.y, p.z); } if (window->KeyDown(Key::Right)) { k->SetTargetPosition(p.x + speed, p.y, p.z); } //Jumping...? joint->SetAngle(jointpos); if (joint->MotorEnabled() == true) { joint->DisableMotor(); } if (window->KeyHit(Key::Space)) { joint->EnableMotor(); } Leadwerks::Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); context->DrawText("Target position: " + String(jointpos), 0, 0); context->DrawText("Current position: " + String(joint->GetAngle()), 0, 20); context->DrawText("Motor enabled: " + String(joint->MotorEnabled()), 0, 40); context->SetBlendMode(Blend::Solid); context->Sync(); return true; } Other links; https://www.leadwerks.com/community/topic/17437-physics-constraints/ Project.zip
  14. Hello every one ! Today i wanted to add c++ code to object but looks to accept only lua script ?‍♂️ It is possible to add c++ into this box Or we just use c++ into app.cpp (add class but every thing is connected to the app file) ?
  15. #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } float jointpos = 1; bool wireframe = false; Joint* joint; Entity* parent; bool App::Start() { window = Leadwerks::Window::Create(); context = Context::Create(window); world = World::Create(); camera = Camera::Create(); camera->Move(0, 0, -4); Light* light = DirectionalLight::Create(); light->SetRotation(35, 35, 0); parent = Model::Box(); parent->SetColor(0.0, 0.0, 1.0); Entity* child = Model::Box(); child->SetColor(1.0, 0.0, 0.0); child->SetShape(Shape::Box()); child->SetMass(1); child->SetFriction(0, 0); child->SetGravityMode(true); joint = Joint::Slider(0, 0, 0, 0, 1, 0, child, parent); joint->EnableLimits(); joint->SetLimits(-3, 1); Model* mdl = Model::Box(); mdl->SetScale(10, 0.1, 10); mdl->SetPosition(0, -2, 0); Shape* shp = Shape::Box(); mdl->SetShape(shp); return true; } bool App::Loop() { if (window->Closed() || window->KeyDown(Key::Escape)) return false; if (window->KeyHit(Key::F3) == true) { camera->GetDebugPhysicsMode() == true ? camera->SetDebugPhysicsMode(false) : camera->SetDebugPhysicsMode(true); } if (window->KeyHit(Key::F4) == true) { camera->GetDebugEntityBoxesMode() == true ? camera->SetDebugEntityBoxesMode(false) : camera->SetDebugEntityBoxesMode(true); } if (window->KeyHit(Key::F2) == true) { if (wireframe == true) { camera->SetDrawMode(0); wireframe = false; } else { camera->SetDrawMode(2); wireframe = true; } } if (window->KeyDown(Key::Up)) { parent->Move(0, 0, 0.1); } if (window->KeyDown(Key::Down)) { parent->Move(0, 0, -0.1); } if (window->KeyDown(Key::Left)) { parent->Move(-0.1, 0, 0); } if (window->KeyDown(Key::Right)) { parent->Move(0.1, 0, 0); } joint->SetAngle(jointpos); if (window->KeyHit(Key::Space)) { if (!joint->MotorEnabled()) { joint->EnableMotor(); } else { joint->DisableMotor(); } } Leadwerks::Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); context->DrawText("Target position: " + String(jointpos), 0, 0); context->DrawText("Current position: " + String(joint->GetAngle()), 0, 20); context->DrawText("Motor enabled: " + String(joint->MotorEnabled()), 0, 40); context->SetBlendMode(Blend::Solid); context->Sync(); return true; } Using the arrows keys to move the sliders parent around you can see that the child takes time to realign itself. Is it possible to stop this delay?
  16. Can this be made a smart pointer so delete doesn't have to be called? int* index = new int[1024]; Or are smart pointers only for creating things like classes?
  17. What's the best way to add physics constraints to a custom player controller? For example, the cylinder shape is pulled toward gravity (which is not always straight down) then collides with an object, how do I stop little movements like sliding and twisting once it collides? As far as I can tell, the inbuilt character controller only slides if the slope is greater than max slope. And when it moves around by key press it doesn't rotate left or right or jitter as it goes over various sloped polygons. Gravity is added like so in a different class to the controller; float _force = -9.8f; entity->AddForce(_gravity->gravityDirection.x * _force, _gravity->gravityDirection.y * _force, _gravity->gravityDirection.z * _force); //gravityDirection is a normalized vector And so far for the controller I've been doing this to make it move; Vec3 _velocity = entity->GetVelocity(true); //Get the current velocity Vec3 _gravityVelocity = _velocity.Multiply(upDirection); //Find how much of the velocity is along the gravity vector Vec3 _otherVelocity = _velocity.Subtract(_gravityVelocity); //Any remaining velocity other than gravity Vec3 _forwardVelocity = _forwardVector * move; //A vector in front of the player and perpindicular to gravity Vec3 _strafeVelocity = _strafeVector * strafe; //A vector that is the cross of gravity and the forward vector (out to the side) Vec3 _jumpVelocity = upDirection * jump; //GravityDirection * -1.0f movementVector = _forwardVelocity + _strafeVelocity + _jumpVelocity; //Find total movement vector (don't normalize, magnitude is speed) entity->SetVelocity((_velocity - _otherVelocity) + movementVector, true); //Subtract othervelocity to get only what gravity is, then add any movemnt entity->SetOmega(0.0f, 0.0f, 0.0f, true); //Been using this to reduce angular rotation, not perfect though The above code has issues still, but it's my attempt at constraining it along gravity unless needed to move. This code isn't done in a physics hook, which I was wondering if that might be better? And here's a quick video showing the physic shape jittering. It doesn't translate to the camera much at the moment but it does when the jitter is larger. Also I can't move the shape along it's local axis because of the jitter and the random rotation that happens as a result of moving. https://youtu.be/ZA_UNsYCEQs Any thoughts on more accurate ways of constraining are appreciated
  18. What would cause the background to seep through the leaves? I've attached the two materials of the trees. PineTreeLeaves.mat PineTreeTrunk.mat
  19. Can the gravity direction be changed on a per object basis rather than per world? I'd like to change the direction for the character controller. Would it be possible to turn off the world gravity and add forces to the controller object, or will this mess things up? ?
  20. Hello, this is my first thread on this forum.? Today i am learning the c++ Official tutorial. But in this tutorial we need to launch our script you print hello world in c++ but it doesn't work, i have a bunch of errors (942) E1696. Any help will be appreciate ?
  21. In my game I store six 2049 x 2049 height-maps in a dynamically created array, like this; size_t mapSize = 2049 * 2049; float* map = new float[mapSize];//approx 16mb When the app closes they are destroyed like this; delete[] map; As far as I can tell, the more data I load in this way, the app will eventually crash with a "bad_alloc" or "memory exception". It doesn't crash when it allocates for the new map I'm loading, it crashes later on when I'm allocating storage for something else. It could be another set of 16mb or the set of 50mb being allocated. Everything will be fine until I add another map. I've tried various things to rule out corrupted files and what not. I've also run the windows "memory diagnostic" just to verify that the ram is working. It should be, I've never had memory issues even with some high RAM demanding games. This is my error catching code too, the memory used is only about 700mb in total. RAM usage is nearly 5gb in the task manager out of 32gb system total. //Class header float* w1_map; float* w2_map; float* w3_map; float* w4_map; float* w5_map; float* w6_map; //class cpp void cFragment::InitMaps() { size_t _mapSize = 2049 * 2049; try { w1_map = new float[mapSize]; w2_map = new float[mapSize]; w3_map = new float[mapSize]; w4_map = new float[mapSize]; w5_map = new float[mapSize]; w6_map = new float[mapSize]; } catch (std::bad_alloc) { long _usedMemory = System::GetMemoryUsage(); std::stringstream _stream; _stream << "Used Memory : " << _usedMemory << "\nFunction : cFragment::InitMaps()\n\nClick OK to Terminate Program."; MessageBox(Window::GetCurrent()->GetHandle(), _stream.str().c_str(), "BAD ALLOC", MB_OK); exit(NULL); } } So I guess my questions are these; Has anyone else had similar issues? Are there limits to how much can be allocated to one pointer? Are there limits to the amount of consecutive calls to "new[]"? I have a 64bit system, but as I understand it L4 and visual studio are 32bit, so the most RAM that can be allocated for the entire application is 4gb?
  22. I'm currently trying to write a shader that makes every triangle of the mesh point to the position of the camera regardless of the camera's rotation. I think I can multiply the vertex positions in the vertex shader by a one of the matrices but I'm not sure which one or how. And I think the camera matrix will rotate the triangle to the same orientation as the camera and not just point to it's position? Basically I need the vertex shader (or geometry if it's easier) to do what Entity::Point() does but on each triangle and not the mesh as a whole. Anyone got any ideas on how to do this? ? EDIT : I've been getting the direction the camera like this; normalize(vsModelVertexPosition.xyz - cameraposition)
  23. Today I feel good to start learning new thing in Leadwerks, that is C++ with long time bought Professional DLC (I did this before but not successful) I remember that now Leadwerks 4.4 support VS2017 then I do some simple steps Create a Blank Project in Leadwerks Editor Open Projects/Windows/TestBlankProject.sln by VS2017 Goto Build > Build Solution F7 then I get this This is what I found https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2019?f1 But I don't understand anything on that page to find the solution (what a long content) I just want to start with a simple "Hello world" test for my new thing, but It seems not to be smooth as I expected.. Please help
  24. I'm using a buffer to draw some 2D graphics too but can't seam to clear the buffer with transparency. I looked at the forum here for the info regarding buffers and 2D drawing; I tried clearing the buffer with this code but only get a white screen; //App Start Buffer* topLevelBuffer = Buffer::Create(1024, 768, 1, 0); //Draw Loop topLevelBuffer->SetColor(1, 1, 1, 0); topLevelBuffer->Clear(); topLevelBuffer->Enable(); DrawUI(topLevelBuffer); _context->Enable(); _context->DrawImage(topLevelBuffer->GetColorTexture(), 0, 0); Anyone had any luck with clearing to a transparent buffer?
  25. When turning an entity, GetRotation() will return correct for a while then the Z axis will pop to zero for a bit before it starts reading properly again. Below is some test code showing the problem. On my current project, sometimes the Turn() function will suddenly pop to random values, but I'm unable to reproduce this here yet. I'm using the latest BETA build. #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {} App::~App() { delete world; delete window; } Model* box; bool App::Start() { window = Window::Create("Turn Test",50,50, 1024, 768); window->Show(); context = Context::Create(window); world = World::Create(); DirectionalLight* light = DirectionalLight::Create(); light->SetRotation(35, 35, 35); Camera* camera = Camera::Create(); box = Model::Box(); box->Move(0, 0, 2); return true; } bool App::Loop() { if (window->KeyHit(Key::Escape) == true) { return false; } box->Turn(0.2, 0.2, 0.2); Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); std::stringstream ss; ss << "rot = " << box->GetRotation().ToString(); context->DrawShadowText(ss.str(), 20, 20); context->Sync(true); return true; }
×
×
  • Create New...