Jump to content

Collisions Not Working On Non-Physics Objects


QuantumPixel
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...