Monday, September 26, 2011

re: Average Velocity from Local Player

Try out this flowgraph to get the average velocity of a local player. The entity Pos node was used earlier to demonstrate getting Local Player pos, it doesn't need to be there fore ave velocity.


3 comments:

  1. Hi Vinh, is there anyway rain can be measured?, like say in a contained box, area or whatever. I'v tried hard rain, drips, sheets n all all sorts with the ground hit. If there's anyway this can register as a type of entity perhaps even using gravity so it registers. Wot r ur thoughts? Rebekah

    ReplyDelete
  2. Sorry, I shld clarify, its not the rain I'd like to measure ultimately but just the amount that goes in a particular defined area

    ReplyDelete
  3. Hi rebekah,

    Apologies for a late reply.

    I would do this by spawning an Architype entity as your rain particle. If this is done on a timer, it is acting like a particle emitter (but the particle being emitted can be identified, since it is something that you've defined in database.) You can copy/paste this spawner a few times.

    how to make spawner using flowgraph:
    use "entity:spawnArchitypeEntity", specify a architype name and a location to spawn at (using graph entity:pos is easiest, then you can move the object around and it will spawn @ that location). You need to enable physics upon spawning by using "physics:impulse" and connecting the output "success" of spawnArchitype node with the input "entityId" of "physics:impulse" node. use a small value (just to wake it up) 0.001 in the z.
    connect a timer to "spawn" input, and change period to 0.1 (10/sec)? or whatever you like.

    how to make an custom architype entity:
    [create a new database (click the DB icon to open the database window), then create a new object, name it something like "rain," assign it a model such as a small ball or cube, give it mass and weight, then click and drag one from DB window into your level, click save database before you close the window]

    This will just help you get the "architype" name of the object you've just created.

    how to get architype name in Flowgraph:
    In flowgraph use "Entity:entityInfo" to get the "architype" name.

    how to detect presence of architype in area using flowgraph:
    Then using "Interator:GetEntitiesInArea" or sphere etc... you can tick "immediate" and take the "count" output to give you the total number of your custom archetype entity that is in the area.

    Cheers,

    Vinh

    ReplyDelete