Jump to content

Portal prototyping


shadmar
 Share

Recommended Posts

I was going to enter the one week game project Aggror started, but I realized I only had 2 evenings to work on it this week, so maybe next time smile.png

 

portal.jpg

 

The portals render their counterpart views using two buffers and the regular diffuse.shader. I use camera:pick to place portals on the walls or roof/floor.

 

When App.player collides with one of them I move player, and set camera orientation to the portal orientation, so all good..

 

My problem is :

 

If I step through the portal I get collision in rapid succesion since player is moved between the portals every frame since collision occur immediatley after player is moved.

 

So I havent figured out a smooth way to solve this, any tip would be appreciated.

  • Upvote 4

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

I always thought we needed OnCollideEnter, OnCollideLeave which might help with this and many other things as well.

 

Maybe chaining multiple collides can work. It's like having 2 lasers at the entry of a door. By telling which one breaks first and which one breaks second you can tell which way someone is going. If you are coming out from a portal you don't trigger the teleporting logic. If you are going into a portal you trigger the teleporting logic.

Link to comment
Share on other sites

What you need to do is have two player entities. For each one, discard collisions that lie on the wrong side of your portal plane (which requires me to add a new callback). Then take the average resulting position and force them both to that.

 

This guy does some insane things using that technique:

  • Upvote 1

 

 

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