QuantumPixel Posted February 5, 2017 Share Posted February 5, 2017 Hello again, Once more, I'm having some issues with the collision system. I have an object in my game that I want to have bouncing back and forth between the map walls that will act as an obstacle for the player character. I cannot use a physics object for this, as it makes the object's behavior inconsistent and difficult to control after its first collision. However, with its Mass set to 0, it no longer registers collisions with the map walls. It will collide with a player character (which is a physics object) and react as it is supposed to, just not with the walls or any other non-physics object placed in the scene. What can I do to correct this and have it register collisions with non-physics objects? Thanks! I don't think it is helpful, but I have included the object's settings and script below, just in case. Settings: Physics Mode: Rigid Body Collision Type: Character (I have tried every available type and none of them solve this issue.) Mass: 0 Character Angle: 0 Swept Collision: False Nav Obstacle: False Script.moveSpeed = 5.0 --float "Movement Speed" Script.initDir = -90 --float "Initial Direction" function Script:Start() self.entity:SetRotation(0, self.initDir, 0, true) self.entity:SetMass(0) dirFlip = 1 end function Script:UpdateWorld() self.entity:Move(0, 0, self.moveSpeed * dirFlip, false) end function Script:Collision(entity, position, normal, speed) dirFlip = dirFlip * -1 end Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted February 5, 2017 Share Posted February 5, 2017 Add self.entity:SetGravityMode(false) in your start function and set your mass to 10. This will make your object collide with the walls. Unfortunately the ball starts going all over the place after hitting the walls twice. Don't know whats going on I'll check again tomorrow once I've had some sleep. Quote Link to comment Share on other sites More sharing options...
Genebris Posted February 5, 2017 Share Posted February 5, 2017 Moving objects with SetPosition or Move will break Physics simulation. What if you give it a mass, set collision to Trigger so it doesn't bounce itself and then control it's movement with PhysicsSetPosition? 1 Quote 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.