-
Posts
4,937 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by gamecreator
-
Yes, it acts strangely there too. But I would think that in either case it should just go to the angle and stop (my project would constantly be giving it a changing angle to go to). Could anyone please take a look at what I could be doing wrong (it's only a few lines of code)? I've uploaded the project here: http://www.mediafire.com/download/b7ma4md5a7vc2rx/TiltIt.zip Thank you. Here's the entire App.cpp #include "App.h" using namespace Leadwerks; App::App() : window(NULL), context(NULL), world(NULL), camera(NULL), levelmodel(NULL), ballmodel(NULL) {} App::~App() { delete world; delete window; } Model* box; Shape* shape; Vec3 camerarotation; #if defined (PLATFORM_WINDOWS) || defined (PLATFORM_MACOS) bool freelookmode=true; #else bool freelookmode=false; #endif bool App::Start() { //Create a window window = Window::Create("TiltIt",0,0,1280,720); //Create a context context = Context::Create(window); //Create a world world = World::Create(); Font* font = Font::Load("Fonts/Arial.ttf",24); context->SetFont(font); font->Release(); //Create a camera camera = Camera::Create(); camera->Move(0,7,-5); camera->SetRotation(60,0,0); //Hide the mouse cursor window->HideMouse(); levelmodel=Model::Load("Models/levelbase.mdl"); Shape* shape; shape=Shape::Load("Models/levelbase.phy"); levelmodel->SetShape(shape); shape->Release(); levelmodel->SetPhysicsMode(Entity::RigidBodyPhysics); levelmodel->SetMass(1000); levelmodel->SetCollisionType(1); ballmodel=Model::Load("Models/ball.mdl"); shape=Shape::Load("Models/ball.phy"); ballmodel->SetShape(shape); ballmodel->SetPosition(0,3,0); ballmodel->SetPhysicsMode(Entity::RigidBodyPhysics); ballmodel->SetCollisionType(1); ballmodel->SetMass(1); Light* light = DirectionalLight::Create(); light->SetRotation(35,35,0); return true; } bool App::Loop() { if(window->Closed() || window->KeyHit(Key::Escape)) return false; // Just for testing purposes if(window->KeyHit(Key::Space)) { box = Model::Sphere(32); shape = Shape::Sphere(); box->SetShape(shape); box->SetPosition(-0.2,5,0); box->SetMass(1); box->SetCollisionType(1); } levelmodel->PhysicsSetPosition(0,0,0,1.0f); if(window->KeyHit(Key:)) levelmodel->PhysicsSetRotation(0,0,-45,0.9f); if(window->KeyHit(Key:)) levelmodel->PhysicsSetRotation(0,0,45,0.001f); Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); context->SetColor(1,1,1); context->DrawText("Z Angle: "+String(levelmodel->GetRotation().z),10,10); context->SetBlendMode(Blend::Solid); context->Sync(false); return true; }
-
Seems like a silly thing to ask but how do you set the angle of a rigid, convex hull physics body? I load it like so: levelmodel=Model::Load("Models/levelbase.mdl"); Shape* shape; shape=Shape::Load("Models/levelbase.phy"); levelmodel->SetShape(shape); shape->Release(); levelmodel->SetPhysicsMode(Entity::RigidBodyPhysics); levelmodel->SetMass(1000); levelmodel->SetCollisionType(1); And tried this in loop: levelmodel->PhysicsSetPosition(0,0,0,1.0f); if(window->KeyDown(Key:)) levelmodel->PhysicsSetRotation(0,0,-45,0.003f); if(window->KeyDown(Key:)) levelmodel->PhysicsSetRotation(0,0,45,0.003f); But that code acts unpredictably. It keeps rotating or slows or doesn't move depending on when I press the button. I changed the last value to 1, to 0 and anything in between. I'd like the angle to be set instantly. It seems like I'm using the wrong function but I need a physics function to do this and there seem to be only two (the other sets position).
-
What version of Leadwerks do you use?
gamecreator replied to gamecreator's topic in General Discussion
Josh seemed to quickly make a lot of progress with some graphics optimizations recently. http://www.leadwerks.com/werkspace/topic/8857-leadwerks-31-framerate-low/page__st__20#entry68531 I'm hoping the same will be the case for physics at some point soon. -
Ah, I didn't know that. Interesting.
-
Nice. Apparently it assigns automatically under special conditions too, if this is correct: http://www.leadwerks.com/werkspace/topic/8906-once-again-multi-material-assignment/#entry68626
-
That's great! But I wonder: why not just assign the materials automatically to the model? Or have the option to? Wouldn't the FBX have the info of which texture goes to which surface?
-
This type of stuff seems to come up often enough. I think Josh mentioned that Leadwerks could assign materials automatically at some point. I know it would save a lot of time for everyone, every time they need to import models.
-
EXCEPTION_ACCESS_VIOLATION Leqadwerks 3.0
gamecreator replied to marcus729's topic in General Discussion
Do you also use 3.1? If so, the problem is likely that LE is trying to load a 3.1 project in 3.0. http://www.leadwerks.com/werkspace/topic/8504-leadwerks-30-autoloads-leadwerks-31-projects/ -
What version of Leadwerks do you use?
gamecreator replied to gamecreator's topic in General Discussion
I'm waiting for the C++ version too (prepaid January 1) but if it runs games at 5 fps then I'll stick with 2 for now. Which made me realize I'm missing some options for people who use 2 with 3.0 or 3.1 but oh well. -
Poll closed. Thanks.
-
Josh is doing almost all of this himself so he has a lot on his plate. The highest priority is likely the fulfillment of the Kickstarter promises, which I think is understandable. That said, if there was even one person who was close to releasing a game made with 3.1, I'm sure that optimization would shoot up on the list of priorities.
-
You should test it in Leadwerks 3.
-
I'd guess he didn't. Voting on a poll brings a thread back to the top of the forums. I imagine someone else voted first.
-
http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&u=vk.com%2Ftopic-67595726_29537156
-
I think the confusion may lie in that supposedly you could get it to work with the Lua version of Leadwerks through some DLL trickery. But hopefully Leadwerks C++ will be released soon and we'll never hear of Lua again.
-
Create a new project Drag a plane (from Models->Primitives) into the Perspective Viewport Drag a second plane into the Perspective Viewport Go to Scene tab Drag the second Skin_Mesh into the first Skin_Mesh Right click on top Skin_Mesh and save Prefab into Models->Primitives Go to Assets Crash If you save it to another folder then go to that folder in the Assets tab then switch to Scene and back to Assets again and it will crash. Edit: seems to happen with other shapes and models as well. I just tried with two cubes and same thing.
- 1 reply
-
- 1
-
How to enable post processing Effects for camera
gamecreator replied to DudeAwesome's topic in Programming
And not just on or off. Allow setting of strength/amount of each effect. -
Thank you Michael. I was slowly coming to the same conclusion. There really needs to be a "movable PolyMesh" solution. Interesting to note that the PolyMesh documentation suggests using Shape::ConvexDecomposition() but there's no documentation for that function yet.
-
This is either a bug or my lack of understanding on how things work. I'd love for Josh to weigh in on which it is. If it's a bug, I'm happy to put a clearer, thorough report in the bug forum. In either case, both Convex and Poly should be able to be controlled with the very basics: moved or not moved and rotated.
-
Next step was to rotate the floor but I can't figure that out either. It seems like if I set the mass to 0 so the floor won't move then it also won't rotate. If I set it to 1 then it falls. Ok, so I use PhysicsSetPosition to keep it in place. But then I have to set the mass to some large number so ball won't just push it around. Fair enough. Then I try to use the following code: if(window->KeyDown(Key:)) levelmodel->PhysicsSetRotation(-1000,0,0,0.1f); if(window->KeyDown(Key:)) levelmodel->PhysicsSetRotation(1000,0,0,0.1f); But that doesn't seem to work on Polymeshes, only Convex Hulls (which isn't what I need). I need to use a Polymesh because my model has columns so it's not convex. Thoughts? Screenshot to better give you an idea of what I'm working with:
-
I've been requesting strength control by code on effects for some time.
-
So good thought but the SetPhysicsMode wasn't necessary. What was necessary was to set the ball to ConvexHull, not Polymesh (seems like I said I tried this in the original post but apparently not). Otherwise it wouldn't fall. It also seems that loading the PHY files yourself is also necessary (though the documentation doesn't do it here). Here's the project: https://www.mediafire.com/?ifbf4eyeee3obg1 If you press the spacebar it will dynamically generate a falling sphere without loading a model (mostly copied from Aggror's code).
-
Thanks. Will try it. Odd though that Aggror's tutorial (linked above) didn't need that line. Maybe it's different with loaded models versus ones generated on the fly?
-
Leadwerks 3.1 : option or something to choose project start
gamecreator replied to YouGroove's topic in Suggestion Box
bandrewk, start the 3.1 editor, load a 3.0 project then load the 3.0 editor. We have to keep juggling projects like this until Josh fixes it. -
I figured the shape would be loaded automatically (like it did in LE2) so I'm happy to get rid of those lines if that's the way to go. The ground is set up exactly the same way. I'm sure the collision works fine as when I create a box dynamically using your code, here http://www.leadwerks.com/werkspace/page/tutorials/_/introduction-to-android-r40 it works and bounces off the ground. But the ground also does the same thing: if I don't load the shape manually it falls, whether or not I set SetMass(0); And your explanation on Convex Hulls makes sense. Thank you. My ground has columns to bump against and the collision only worked properly with Polymesh. I'll upload my project when I'm home if there's no solution to this but there's gotta be something simple I'm missing.