Jump to content

Odd physics stuff


aarrowh
 Share

Recommended Posts

I'm testing out different types of physics pads (Jump pads, boost pads) I've found a couple odd things.

 

1. When you use a jump pad and hit the bottom of a brush my controller(FPS prefab) goes straight through and lands on the top

 

2. when using a force based boost pad, going any direction other than straight will instantly kill you.

 

 

Both pads are based on the JumpPads tutorial.

Link to comment
Share on other sites

*edit* it says I'm not permitted to upload .map files

 

Script.JumpForce = nil --vec3 "Jump Force"
Script.SelectiveCollision = false --bool "Selective Collision"
Script.ColObj = nil --Entity "Collision Object"
Script.Active = false --bool "Active"

function Script:Start()

end
function Script:Enable()
if self.Active == false then
self.Active = true
end
end
function Script:Disable()
if self.Active == true then
self.Active = false
end
end

function Script:Collision(entity, position, normal, speed)
 if (self.SelectiveCollision == true and entity == self.ColObj ) then
		 self.ColObj:AddForce(self.JumpForce)
 elseif (self.SelectiveCollision == false) then
		 entity:AddForce(self.JumpForce)
 end
end

That is my jumppad script

 

 

Both brushes of ground are set to rigid body and scene.

Link to comment
Share on other sites

Well. at least point 2 makes sence because if you look into the script you will see this part:

function Script:Collision(entity,position,normal,speed)
 if speed>20 then
   self:Hurt(100)
 end
end

which means that if the character collides with something at a speed greater 20 you will be killed instantly.

 

Edit: i of course mean the FPSPlayer.lua script

Edited by beo6
Link to comment
Share on other sites

Well. at least point 2 makes sence because if you look into the script you will see this part:

function Script:Collision(entity,position,normal,speed)
if speed>20 then
self:Hurt(100)
end
end

which means that if the character collides with something at a speed greater 20 you will be killed instantly.

But if I'm still on top of the same brush I'm not colliding with anything new, and that also wouldn't explain why getting pushed straight is ok but not a different direction.

Link to comment
Share on other sites

i don't know your exact level build but you don't need to collide with anything new because collision is called i guess every frame or so when you collide with anything other then a Trigger.

 

Do you still get killed if you comment the line "self:Hurt(100)" out?

Link to comment
Share on other sites

i am not sure. That would require a bit of try and error.

 

My first guess is that it possibly collides again with the Trigger object.

 

Try this to have Triggers not kill your character: (not tested code)

function Script:Collision(entity,position,normal,speed)
 if speed>20 and entity:GetCollisionType()~=Collision.Trigger then
    self:Hurt(100)
 end
end

Link to comment
Share on other sites

i am not sure. That would require a bit of try and error.

 

My first guess is that it possibly collides again with the Trigger object.

 

Try this to have Triggers not kill your character: (not tested code)

function Script:Collision(entity,position,normal,speed)
if speed>20 and entity:GetCollisionType()~=Collision.Trigger then
 self:Hurt(100)
end
end

 

This didn't work, i tried playing with it a bit, and still nothing. But I did notice that it is still killing me even if the force is set under 20

Link to comment
Share on other sites

Your problem could be BSP or physics on BSP, i played a good bunch with BSP , models and physics and there are some serious physic bugs. Perhaps you are in one of these physics problem ?

 

 

ok so how does game works ? you walk on yellow area and your character jumps ? on grey area nothing special just a walkable surface ?

is there any danger area ?

Stop toying and make games

Link to comment
Share on other sites

The force is perhaps too high also :

I made some F-Zero style prototype using BSP cubes, and i got the bsp cube vehicle passing throught level caus of velocity.

Why not : reducing force and just detect blue collision ?

or use : PhysicsSetPosition to manually make the player fly vertical to blue until it collides with blue volume ?

OR use raycast above player head to detect the Y possible collision , and after yellow jump, make it jump until it reaches the players head , you could make it jump until it reaches or have a great Y value than Y collision reported by raycast. This way, you could use any velocity.

Stop toying and make games

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...