Adam Ferestad Posted March 5, 2013 Share Posted March 5, 2013 I am still working on this research project, and I am running up against a few rather serious blocks trying to derive the information from the simulation to input into the functions I have developed. The goal of the project is to make a traffic simulator that can be used as a drop in for even complicated city scenes with minimal input required from an artist. I currently have 2 functions, one for the particle velocity and one for the turn velocity in the intersections. I will break down each, hopefully someone will be able to help me figure out how to generate my needed attributes. Velocity: Simple enough, x is the only variable I care about here. It refers to the distance between a given particle and the next nearest. This one is designed to allow for automatic adjustments in velocity so the "cars" don't collide. As the cars get close together, the whole thing aproaches 0, farther away it goes to 1 and moves smoothly between the two. I will be multiplying this by a scalar and direction vector to give an actual velocity vector. I have already figured out the parameters for it using some math modeling software, but in houdini I am struggling with calculating the next nearest particle. I know I can use the distance VOP to get the actual variable, but for that I need the nearest particle value. Rotation: This is intended to go in the Turn POP. For this one I need to get two variables, but only on collision with one of my intersection boxes. v is the velocity that the particle has at collision. s is the distance from the colision point to a reference point on each intersection. The calculation will (should) give the correct deg/sec to calculate correct turn rate to move in a perfect quarter circle with a turn radius of s. Also, I need a way to switch between these, meaning out of intersections the speed varying function takes effect, in intersections the speed is held constant and the turn node takes effect, turning the particle through the intersection. I am planning on using the collision POP's numhit value with a mod2 so it alternates between 0 and 1 for even and odd hits. since each intersection will produce 2 hits, it should work out perfectly. unfortunately I cannot seem to figure out how to use numhit or any other attribute in a switch node. city streets basic.hipnc Quote Link to comment Share on other sites More sharing options...

sam.h Posted March 6, 2013 Share Posted March 6, 2013 (edited) The proximity node in POPs will give you an attribute for the nearest particle. The switch node doesn't work per particle, you could create groups based on you numhit attribute for inside/outside of an intersection, then get you functions to operate on only a specific group. Does that make sense? Edited March 6, 2013 by sam.h Quote Link to comment Share on other sites More sharing options...

## Recommended Posts

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