Jump to content

Physics Trigger without Character Cylinder Shape


Slastraf
 Share

Recommended Posts

I am asking myself how to make a sphere that intersects with an other object notice that it did ?

The problem with that is that,

- I need no character physics shape, i want to keep the physics shape of the sphere.

- Also I want no collision sice it would make no sense in the game I am currently making.

 

It works with A character physics shape and a trigger, but the cylinder that is the only option with the character mode is not usable as said.

 

To make it clearer, heres a screenshot of my game.

It is an endless procedual generated game, the sphere is made visible on purpose. (to see if it should intersect)

 

post-12189-0-05571700-1456001486_thumb.jpg

 

The Sphere is controlled by the mouse, and when it hits the white object, it has a flickering effect and a life less but not change the movement when colliding.

Link to comment
Share on other sites

function Script:Start()

Collision:SetResponse(10, Collision.Prop, Collision.Trigger)

self.entity:SetCollisionType(10)

end

This is what I have inserted in the script which has every obstacle.

I added self.entity:Hide() for testing in collision function of the hitbox and the obstacle,

both dont work.

The physics type of the obstacle is set to trigger , the hitbox to prop in the editor (with the attached scripts)

Link to comment
Share on other sites

Player controlled item is set to collision prop, and give it mass.

item that gets hit, set to Collision trigger and give mass.

SetGravity to nil on both if not needed.

 

In the script.start function of the item being hit put

Collision:SetResponse(10,Collision.Prop, Collision.Trigger)
self.entity:SetCollisionType(10)

in the script.collision function put

collisiontype = entity:GetCollisionType()
if collisiontype==Collision.Prop then
self.entity:Hide()
end

 

Also in player item put

function Script:Collision(entity, position, normal, speed)
collisiontype = entity:GetCollisionType()
if collisiontype==10 then
self.entity:Hide()
end
end

  • Upvote 1

Elite Cobra Squad

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