X54321 Posted January 31, 2014 Share Posted January 31, 2014 ANSWERED Hi, I just bought this engine a couple of days ago. It's really nice so far, but the physics engine is kind of glitchy. There have been other posts on the physics engine, and so I am aware the developer is working on it. BUT, the game I am looking to make doesn't need any sort of physics; I just need collision. Unfortunately, I can't seem to collide with anything if the mass is set to 0. If I enable physics, I can't seem to get it to not move, and It goes through everything. SO, does anyone have an idea? *EDIT: I am using a rigid body character, not a character controller. Quote Link to comment Share on other sites More sharing options...
DudeAwesome Posted January 31, 2014 Share Posted January 31, 2014 can you post your code? when you use a character controller you have to use SetInput() and not SetPosition(), Move() or Translate() Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
X54321 Posted January 31, 2014 Author Share Posted January 31, 2014 I'm not using a character controller, I can't customize the character controller at all. I'm making a 2.5d platformer, and I'm using a rigid body for the player (without mass). Quote Link to comment Share on other sites More sharing options...
X54321 Posted January 31, 2014 Author Share Posted January 31, 2014 Found a solution. I just had to use SetPosition() instead of PhysicsSetPosition(), and then I could have physics on without the player being moved when I didn't want him to. 1 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 1, 2014 Share Posted February 1, 2014 I know it will take a while but I'm really curious what you come up with. One of my inspirations is another Leadwerks 2.5d platformer: http://www.leadwerks.com/werkspace/files/file/278-the-last-chapter/ You probably can't download it as it was an LE2 project but take my word that it's pretty cool. The other bigger one is Trine / Trine 2 but that involves physics and control that I don't think Leadwerks can do yet. Quote Link to comment Share on other sites More sharing options...
DudeAwesome Posted February 1, 2014 Share Posted February 1, 2014 trine was made with leadwerks? Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
X54321 Posted February 1, 2014 Author Share Posted February 1, 2014 Ok, so it turns out that method had a lot of collision bugs. I then came up with a new solution that uses the physics, and it (almost) works, but it is really weird. The physics for the player are so jittery it makes the game virtually unplayable. I don't think it's lag, either, because the frame rate is about 180! I'll put up the project in a moment; It'll take a while to upload. Quote Link to comment Share on other sites More sharing options...
X54321 Posted February 1, 2014 Author Share Posted February 1, 2014 OK, here's the project link : https://drive.google.com/file/d/0BzyMN5S2kRTHZjIxd1NUSG9BdzA/edit?usp=sharing Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 1, 2014 Share Posted February 1, 2014 trine was made with leadwerks? Whoops, no. Didn't mean to imply that. There was a thread today about physics. I think the jitter involved using two functions together that shouldn't be (maybe one physics and one not). Couldn't find it at the moment. Thanks for the project link. Will check it out at home. Quote Link to comment Share on other sites More sharing options...
Josh Posted February 1, 2014 Share Posted February 1, 2014 Your call to SetRotation() is resetting the entity physics each frame, and it's also called in UpdateWorld() instead of UpdatePhysics(), where it should be (if at all): I changed the command to PhysicsSetRotation() which will do the same thing by applying torque to the object. local window = Window:GetCurrent() local onGround = false function Script:Start() x = self.entity.position.x y = self.entity.position.y z = self.entity.position.z end function Script:UpdatePhysics() window = Window:GetCurrent() if window:KeyDown(Key.D) and not cRight then self.entity:SetVelocity(Vec3(10, self.entity:GetVelocity().y, 0)) elseif window:KeyDown(Key.A) and not cLeft then self.entity:SetVelocity(Vec3(-10, self.entity:GetVelocity().y, 0)) end if window:KeyDown(Key.W) and onGround then self.entity:AddForce(0,500,0,true) end --self.entity:SetRotation(0, 0, 0) self.entity:PhysicsSetRotation(0, 0, 0) self.entity.position.z = -6.0 onGround = false end function Script:Collision( entity, position, normal, speed ) --print(normal.y) if normal.y > 0.0 then onGround = true end end You will always have problems if you try to make a rigid body behave like a character controller, because a character controller is fundamentally unrealistic...it always points straight up and down and can't rotate around the XZ axes. Even if you use a force to try to change the orientation, that force will have other unintended effects. The character controller is specifically designed for this type of movement and should really be used here. There are previous projects that used it in this way. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.