• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By eldwin11929
      We're looking for a Unity (C#) Programmer for our 2D Project. We're looking for a new lead programmer to continue with an existing project.
      Project is an open-world RTS, and is very close to a prototyping (playable) phase. Our existing lead, unfortunately, has no more time for the project, and thus we are in search of a new one who is interested.
      Game is purely fantasy based, and we'll be able to give you much more detailed info about the project as we begin to work you into it.
      You'll be working with our junior developer, who has been here since the beginning.
      Primary skills needed are just being able to work within Unity. But skills within XML are also a plus.
      Our list of major goals we'd need you to do is minimal, yet still fairly extensive:
      -Edit our current Pathfinding system to account for a few extra features.
      -Setup our global map system. You’ll be working off an existing random node-map web generator and existing random map generation system and essentially linking the two together. This includes handling random spawns (which has already been semi-setup) unique to each node’s respective map.
      -Further implementation of an existing random spawning algorithm (used to spawn things like enemies randomly across the Map).
      -Making sure to Save and Record all respective aspects of what was mentioned above.
      -Handling our XML database- database is created, but we’ll need to be integrating it. This includes all various things from units to abilities and so forth. Will also need to handle implementing an object’s unique attributes we cannot take care of within XML.
      -Various Content Implementation (to be done once our XML has been integrated).
      -Various Saving and Recording of all respective aspects of the database info mentioned above.
      -Various Performance Enhancements.
      -Potential for various misc things, such as further UI work.
      -Setting up a Menu system.
      We have a considerable amount of things done already- however I must warn ahead of time we have quite a bit of unclean code, which may be fairly overwhelming for a new developer on the project.
      Let me know your rates per hour, and we'll see if we can work out a good deal between both of us. Royalties are also included.
      If interested, send an email to: eldwin11929@yahoo.com
    • By jhocking
      My bestselling and highly recommended Unity book has been fully revised! Unity in Action, Second Edition teaches you to write and deploy games with the Unity game development platform. You'll master the Unity toolset from the ground up, adding the skills you need to go from application coder to game developer.

      Foreword by Jesse Schell, author of The Art of Game Design

      Don't take my word for it being good, look at the sky-high ratings on GoodReads.

      You can order the ebook directly from the publisher's site, or order the book on Amazon to get both the physical book and a coupon to download the ebook!
    • By ThunderTwonk
      Hello everyone, I am working on a game idea and since I am still in the process of learning C# and the features available in unity I was hoping some of you might be able to offer me a little insight on things in general for getting started.
      I guess the basic components of what I'm wanting to create would be a Multi-levels management/city builder/rpg.
      The goal is to provide a framework for players to interact with, build in and affect the world both from a 3rd person action RPG as well as a zoomed out 4x style view (This would be something unlocked through gameplay)
      As for my questions go I was wondering if anyone had resources that could help me learn.  I've been on youtube as well as enrolled in an online course for basic unity and C# and will continue those but if anyone has any words of advice, a place that has good information and tutorials etc.
      Thanks for your time.
    • By Cahit Karahan

      Hi, I'm new in this forum. It is honorable to see such communities exist. I would like to share my new game. I did for android with unity. I know the game is a little awkward , but you have to know that this game is from the time when Unity's name is Unity3D  I have made my first game when I was 12. Now I am 22.  I have taken a lot of experience in this process and I can make better games nowadays. I have published this game nowadays but actually this game is very old but also it is very special for me :))
      I have just wanted to retouch and share this game, because it has a very important place for me.

      It's a special free 3D horror adventure action game for the halloween. Fun with scary sound effects and musics, 3D realistic graphics, you will feel the horror in the deep of your heart. Use your reflex. Totally free adventure. Totally scary horror game. 

      Tamarra, she is a beast from our world. She needs to consume souls from innocent people to stay alive. Story begins, the old Elaris tribe had lost their everything because of this beast who lived in the well. Araknas was the most powerful warrior of the tribe. One day, Araknas's mother was killed by the servant beasts of Tamarra. That's how Araknas's journey to the well begins. Tamara's well is guarded by horrible beasts. Araknas has to pass all servant beasts until he reaches Tamarra.

      Even death at the end is worth the revenge. 
      Are you brave enough to jump into Tamarra's well?

      Survive from witch attacks, clown attacks and many scary creature.

      - Realistic 3D graphics.
      - Scary sounds.
      - Scary musics.
      - Best experience with headphones.
      - A demon cage where you can imprison all the demons one by one
      - The witches do not like help, but they love blood stone. Witch store where you can develop your abilities and get new abilities.
      - Countless beasts.
      - At the end of the well there is a hidden surprise for you.

      *We do not recommend this game to people with clown phobia, spider phobia, or panic attacks.*

      **!!!**Note : This game is an early-access game, we are upgrading new features every day, new beasts, new improvements, as an example online 1vs1 fall on the list, so stay on connect and follow Halloween : Horror Well on Google Play.**!!!**

    • By INFRA
      SCAN. DRILL. SURVIVE.   ISOLATED Release in May 1st 2018   https://store.steampowered.com/app/805950/Isolated/   A game by Jérémie Bertrand Music & Sound Design by Pierrick Querolle *** Our solar system has been invaded by strangers. For the purpose of a possible negotiation, a team of astronauts is sent to the moon. Alas, they are shot before even arriving on the scene. Only one astronaut survives the crash and his only goal will be to go home...   GAMEPLAY   Shoot enemy ships to avoid being invaded. Be precise in your movements, because it's better to lose a bit of life at the top than to lose it all at the bottom. Take out your drill to destroy the stones in your path. Validate your identity to cross the different laboratories. Reach the flag before losing your three lives.   And all that... at the same time! Will you be able to go home? If the answer is yes, how long will it take?
  • Advertisement
  • Advertisement
Sign in to follow this  

Unity Scene / ray-intersection

Recommended Posts

What is the best approach for scene ray-casting? I want to use it for calculating shoot target (decals positions), A.I. (visibility), picking (moving units accross the map) and possible ray-casting (some effects).  There could also be some other use cases in the future.


I was thinking about an octree, but I am not quite sure what to store inside. Storing single triangles in leafs will lead to the huge waste of space (ID of geometry, ID of triangle plus the tree itself). Yes, I can have a simplified models (so less triangles), but this will work for A.I., but not for obtaining shoot target position for decals rendering and picking can also be inaccurate.


For only picking, I can use depth buffer, but it is also not quite precise for positions further from near plane. I was looking into Unity solution and they have Physics.Raycast. However, I am not able to find whats behind.

Edited by Martin Perry

Share this post

Link to post
Share on other sites

Usually you have some association between your collision geometry and units (e.g. a simple user pointer). Then you simply cast into the physics scene and get the unit back from this. Are you using a physics engine already and need help how to integrate this?

Share this post

Link to post
Share on other sites

A third party physics engine seems the best solution here otherwise you could simply create your own set of bounding volumes; at least Box and Sphere/Cone and do a simple geometric Line/Box, Line/Circle or Line/Cone intersection test testing those objects that are on-screen

Share this post

Link to post
Share on other sites

Depends if you are using a physics engine or not.


If you are not, start off simple. Fire a ray from some position (mouse position on the screen or is it an object in game etc.) and test for an intersection with an AABB or Sphere as these are very easy to implement. Once you have that working you, I would then start to think about how you could use something like an octree or other types of ray intersections.

Share this post

Link to post
Share on other sites

I have already implemented bounding primitives / ray intersection. The problem I have is, how to detect actual triangle. Calculate it brute-force (even if I have the object from AABB or other primitive-ray intersection), is quite slow. With bounding geometry, I am unable to get precise points on surface.

Share this post

Link to post
Share on other sites

How precise should you results be? Normaly a physics mesh is way more low poly than a visible rendered mesh. As I wrote in another post we have used collision detection based on a kind of quadtree, a collision tree sampling down the areas of the model to achive a seek cost of O(log(n)) for acurate collision hits

Share this post

Link to post
Share on other sites

Ideally precise... I am using it in an "editor" like system, where I need to pick the actual triangle and position within it. I would also like to try ray-tracing on my scene, so I need precise ray intersections.

I am currently trying to implement it based on the outputsfrom deferred renderer (depth G-buffer and added triangle ID buffer) with a combination of octree (quadtree)

Share this post

Link to post
Share on other sites

Ideally you would have some kind of broadphase (e.g. a dynamic AABB tree) which stores all the *unit* AABBs. Dynamic because you can select units and move them around. Once you have determined the unit you are hitting you need to decent further based on your current selection mode (e.g. vertex, edge, or face). Usually you have some kind of static AABB tree or a kd-tree for these operations. 


Why would you need triangle selection in your editor? If you want to support basic modelling operations you need to check for a good mesh data structure (e.g. a relaxed half-edge data structure) and a dynamic structure which can be updated. You can also build the acceleration structures on the fly. In an editor you only need what it is called interactive performance. This is usually defined as the time an artists waits before he opens his web browser or email client. This is a very short time, but still much more than 16ms :)


The decals are kind of a fuzzy issue. If you have low poly collision models the results might not look good enough. In that case you need a way to also cast against the render geometry. Maybe it is a viable assumption to only cast against the static world geometry in which case you could have a very efficient kd-tree for these kind of casts,

Edited by Dirk Gregorius

Share this post

Link to post
Share on other sites
On 12/7/2016 at 8:22 PM, Martin Perry said:

I was thinking about an octree, but I am not quite sure what to store inside.

Based on ray-tracing experience, a BVH (built with the SAH or some other intelligent heuristic) is way better in pruning geometry than an octree at the expense of a slower build time. The BVH is also more memory efficient and can be dynamically updated as well.

Edited by matt77hias

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement