Using Unity, implement the Kinematic Arrive algorithm. The program should have a character and plane on which the chara

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Using Unity, implement the Kinematic Arrive algorithm. The program should have a character and plane on which the chara

Post by answerhappygod »

Using Unity, implement the Kinematic Arrive algorithm. Theprogram should have a character and plane on which the charactercan move. The program should also allow the user toleft-click anywhere on the plane causing the character to performthe Kinematic Arrive algorithm to move toward that spot. Oncethe character has successfully arrived and stopped at thedestination, the user should be able to click again to performanother move.
Built-in graphics and game objects will suffice (although youmust be able to tell the orientation of the character).
Using Unity Implement The Kinematic Arrive Algorithm The Program Should Have A Character And Plane On Which The Chara 1
Using Unity Implement The Kinematic Arrive Algorithm The Program Should Have A Character And Plane On Which The Chara 1 (251.97 KiB) Viewed 72 times
X 9 10 11 13 14 15 It 17 18 19 20 21 12 23 15 17 18 19 33 35 37 38 39 40 The algorithm now looks like the following: class KinematicArrive: # Holds the static data for the character and target character target # Holds the maximum speed the character can travel maxSpeed # Holds the satisfaction radius radius # Holds the time to target constant timeToTarget = 0.25 def getSteering(): # Create the structure for output steering = new KinematicSteeringOutput() #Get the direction to the target steering.velocity = target.position - character.position # Check if we're within radius if steering.velocity.length() < radius: We can return no steering request return None #We need to move to our target, we'd like to # get there in timeToTarget seconds steering.velocity /= timeToTarget # If this is too fast, clip it to the max speed if steering.velocity.length() > maxSpeed: steering.velocity.normalize() steering.velocity *= maxSpeed #Face in the direction we want to move character.orientation =
41 42 43 45 46 getNewOrientation (character.orientation, steering.velocity) #Output the steering steering.rotation = 0 return steering We've assumed a length function that gets the length of a vector.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply