|06 June 2011|
Full Sail University
Winter Park, USA
There's some great information here, I have something I've been trying to do related to this.
I'm trying to create an enormous flock of bats that can be dynamically influenced. One problem I'm having is getting the direction of the individual bats and awareness of the other bats around it.
Anybody have ideas?
|07 July 2011|
Trying to keep this little kick ass thread alive.
I have bugs crawling along skin and I've got them rotating around based on the normals which is great. And random Y rotation is easy enough.
I am however trying to figure out how I can get the Y rotation to aim in the direction that the particles are moving.
|03 March 2012|
Los Angeles, USA
Bringing this one back.
Anyone have a solution for the above post.
I'm working on something similar and can't seem to get the insects to aim in the direction of the velocity and have them orient to the surface normal.
|03 March 2012|
Los Angeles, USA
Figured it out like 2 minutes later and thought I'd post the solution in case anyone else needs it.
Aim Direction : Velocity
Aim World Up: goalWorldNormal0PP
With that setup in the instancer, the particles will aim toward their velocity and still be oriented correctly on the surface.
|06 June 2012|
I don't know what i'm doing wrong..
I guess that when it comes to scripting I get lost most of the times...
Anyways, could someone help me figure out why this is not working for me? All I wanted is for the instances make a kind of grid with crosses, using the sphere as a dome with a cross on each vertex...
I used YDP scene file as a start and copied the expressions...
I uploaded my scene.
Thanks a lot!!!
Check out my REEL
|09 September 2012|
Gregory De Pena
Design OPERA, Inc.
San Diego, USA
Originally Posted by ctp: Runtime expression:
Optionally you can add the runtime expressions in the creation too.
Also, notice the "pPlane1", which should be corrected to match the name your poly object.
I'm trying a variation of yours but i can't seem to get it right! I work with the Z up and thus i'm attempting to modify your code for one with the Z up.
This is the expression that i'm creating:
// sets the orient axis for the instance
particleShape1.aimUp = <<0,0,1>>;
// get surface normal at particle position
vector $particlePos = particleShape1.position;
vector $normal = `nearestPointOnMesh -ip ($particlePos.x) ($particlePos.y) ($particlePos.z) -nr -q pPlane1`;
// orient the instance
particleShape1.aimDir = $normal;
// random rotation for Z axis
particleShape1.randomRotationZ = rand(360);
//solve each angle, convert to degrees
float $rotX = rad_to_deg( atan2( ($normal.y), ($normal.z) ) );
float $rotY = rad_to_deg( asin( -($normal.x) ) );
// asign random rotation in Z
particleShape1.rotationPP = << $rotX, $rotY, particleShape1.randomRotationZ >>;
any help with this will be greatly appreciated, i've attached my file for your reference.
Last edited by gdepena : 09 September 2012 at 05:19 PM.
|02 February 2013|
Lord of the postsportfolio
Kevin Elliott Wilson
Culver City, United States
great thread and another resurrection!
so i was mucking around with YourDaftPunks scene (thanks) and stimuli's post trying to aim the poly planes to a camera in the y axis whilst maintaning the orientation to the surface.
i am trying to replicate a ground cover system in a game engine. don't ask why, but I am!
i think stimulis solution for aiming would break the surface orientation?
thanks for the informative read guys.
|04 April 2013|
Originally Posted by linuxInferno: gotta love the undead threads
duplicate your instanced geo a couple of times and rotate them randomly in y.
freeze all transforms
instance with indexPP set to rand( 0 , numOfInstances+1 )
its kind of a cheat because the idea is to just make a connection instead of duplicating and making your scene bigger. but sometimes getting it done is more important than doing it "properly"
Just like when someone hands you a scene file with an outliner thats 5000 pages long of unnamed nodes and you dump in a new group named "screwYouUnorganizedJerk"
...or maybe its just me. haha
He can add a custom attribute randomRotation and give and give it this expression :
particleshape1.randomRotation = rand(0,0.360,0)
and map it to the rotation, like that he will get random rotation on all the instances on the Y axis.
the bad thing about doing it with Index is that more indexes in the instances effect the ram during the rendering and slow down a bit the render if the objects instances get pretty big with complicated shader network complicated .
|10 October 2013|
getting degrees with angleBetween command, and with random X rotation
// getting particle location
vector $p = nParticleShape1.position;
// calculating normal
vector $normal = `nearestPointOnMesh -ip ($p.x ) ($p.y) ($p.z) -normal -q pSphere1`;
// solving angles
float $angBet = `angleBetween -euler -v1 1 0 0 -v2 ($normal.x)($normal.y)($normal.z)`;
// setting rotation with random
nParticleShape1.rotationPP = <<($angBet+rand(180)), $angBet, $angBet>>;
here your object for instancing should be heading x direction with its "up"
Last edited by PurpleRainbow : 10 October 2013 at 09:09 PM.
|Thread Closed share thread|