1 / 43

Behavioral animation

Behavioral animation. CSE 3541 Matt Boggus. Material recap and trajectory. Geometric Artist specifies translation and rotation over time Physically based Artist specifies forces acting on objects Motion equations dictate movement Behavioral Artist directs autonomous agents

Télécharger la présentation

Behavioral animation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Behavioral animation CSE 3541 Matt Boggus

  2. Material recap and trajectory • Geometric • Artist specifies translation and rotation over time • Physically based • Artist specifies forces acting on objects • Motion equations dictate movement • Behavioral • Artist directs autonomous agents • Interpolation • Artist draws the scene at the beginning and end of a an interval of time • Intermediate positions are calculated

  3. Behavioral Animation • Control the motion of one or more objects using virtual actors • Goal: realistic or believable motion so that the object appears to be autonomous • Matt Lewis’ page on BA http://accad.osu.edu/~mlewis/Class/behavior.html

  4. Behavioral animation • Character or object motion based on: • Knowledge of the environment • Aggregate behavior • Primitive behavior • Intelligent behavior • Crowd management

  5. Actor properties (position only) Goal (xg, yg) V = Goal - Position Next Position = Position + V * dt Position (x, y)

  6. Actor properties (position and orientation) Orientation (ox, oy) = transform.forward Rotate(θ) Determine which rotation (±θ) orients the actor closer to the goal using dot product Rotate(-θ) Goal (xg, yg) Vtarget = Goal - Position Position (x, y) In Unity, you can use RotateTowards()

  7. Sample code class OrientedAgent2D { // Data Vector3 position; GameObjectmodel; // Use this for geometry and orientation // Methods Update(float deltaTime); TurnLeft(); TurnRight(); MoveForward(); MoveBackward(); };

  8. Knowing the environment • Vision and other senses • Information available now • Memory • Information stored from the past

  9. Vision • General vision • What can the actor see? • What is everything in sight now? • Targeted vision • Can the actor see object X? • Computation vs. accuracy • How much of an object needs to be seen to be identified? • Do we need to model visual perception?

  10. Omniscience Everything in the scene is known

  11. Field of view

  12. Field of view – example Orientation Vector (O) Vector from agent to vertex (V) Angle of cone = θ Inside the cone when the angle between O and V is less then or equal to θ/2

  13. Field of view – sample code Vector3 agentPosition, orientation, objectPosition; float visionLimit; Vector3 agentToVertex = objectPosition – agentPosition; agentToVertex.Normalize(); if(Vector3.Dot(agentToVertex,orientation) > visionLimit) // agent can see object

  14. Occluded Vision Ray casting with collision detection Sample the environment

  15. Target-testing vision (per object) How well can the actor see X? Use multiple rays Can the actor see X? Cast a ray

  16. Target-testing vision (alternative) Sample the vision cone Cast multiple rays

  17. Lab4 – predator-prey simulation • Unbalanced abilities • Vision • Distance • Field of view • Linear speed (moving forward) • Angular or rotational speed (turning)

  18. Spatial Occupancy

  19. Other senses • Hearing • Smell • Sensors & signal propagation • Spatial occupancy approach • Applications

  20. Memory • What is recorded about the environment • Spatial occupancy • Transience of objects: time-stamps • Memory hierarchy: short-term, long-term

  21. Spatial Occupancy transiency doorway doorway wall

  22. Aggregate Behavior: Emergent Behavior Typical qualities

  23. Emergent behavior • Complex systems and patterns arising out of simple rules • Aints– AI ants http://www.youtube.com/watch?v=rsqsZCH36Hk

  24. Predator Prey vision anatomy

  25. Prey-Predator (vision)

  26. Prey-Predator (movement – speed and turning)

  27. Motion – force based Force = c * posprey - pospred Apply a force on the predator towards the prey when in view

  28. Motion – kinematic based vnew vold Determine the closest prey in view then turn towards it and increase forward velocity

  29. Prey-Predator – environment forces Using pure forces May not prevent object penetration Prey can be ‘hidden’ by environmental repulsive forces

  30. Flocking, Swarming, Flying Boids http://www.red3d.com/cwr/boids/

  31. Local control Rules defined to stay with friends, but avoid bumping into each other Need additional rules for collision avoidance with obstacles

  32. Local information

  33. Other flocking issues • Global control • script flock leader • global migratory urge • Negotiating the motion • Separation, alignment, and cohesion may compete/contradict • Collision avoidance • Once an object is in sight, start steering to avoid • Splitting and rejoining (difficult) • Collision avoidance too strong – flock may never rejoin after split • Flock membership too strong – flock does not split and formation changes • Modeling flight

  34. Forces Or “Reasoning” (e.g. rule-based) Negotiating the motion

  35. Navigating obstacles Problems with repulsive forces

  36. Navigating using bounding sphere

  37. Navigating Testing for being on a collision path with (bounding) sphere Given: P, V, C, r

  38. Finding closest non-colliding point Calculate s,t

  39. Modeling flight – common in flocking

  40. Modeling flight Geometric flight – dynamic, incremental rigid transformation of an object moving along a tangent to a three dimensional curve

  41. Modeling Flight – Lift Air passing above wing most travel longer than air below it. Less pressure above wing = lift

  42. Modeling Flight – turn by rolling

  43. Modeling Flight – summary • Turning is effected by horizontal lift • Increasing pitch increases drag • Increasing speed increases lift

More Related