Tag Info

Hot answers tagged

2

I assume you know the basic maths stuff concerning angles, movement, distance and all the other stuff. You have these goals: reach destination do random stuff stay inside (rectangular?) area of playfield Your plane could have these properties: position pos forward-speed vel forward-acceleration acc heading/rotation in degrees rot angular velocity ...


1

The most simple solution must be to randomize path points. Each point can only be within a certain angle from the previous ones. After x points have been created, change the angle setting to make it steer towards the destination. Something like this: Vector2 currPos = plane.pos; Vector2 currDir = plane.startDir; for(int num = 0; num < MaxPoints; ...


1

They are hard to debug, so a glitch (possibly caused by accidental over optimization) cannot be fixed easily. Because of this, any neural network used it games should learn in real time during gameplay. However, they have been used, for example the game NERO.


1

You may be interested in Nodal Pathfinding. The concept is similar to placing waypoints, except you generate these way points on top of your world. The waypoints are then used with an A* pathfinder, to determine the optimal path. Have a look at the blog here: http://www.jgallant.com/nodal-pathfinding-in-unity-2d-with-a-in-non-grid-based-games/ Another ...


1

Use waypoints in your map. The enemy AI in "patrol" state chose a random visible waypoint as target. Reached the waypoint repeat step 1. (eventualy excluding current waypoint) If you don't want to place manualy waypoints you can generate them at the corners via script : here follow an example: cons: the enemy will patrol in straight lines from ...


1

Hey there are couple of things which you are missing out. 1) Even thought the motion is in 2d plane but the gameobject dimension is 3D, so use Vector3 instead of Vector2 2) When you calculate Vector3 Movetowards it returns a value which is calculated upon current position , target position and speed. This needs to be assigned to the transform of the AI. ...


1

As Vector2 is a type composed by two numbers which are x and y, then you should be able to get the position by asking both numbers: Vector2 YourVar; YourVar.x; YourVar.y; So you should use something like: SetPositionToMove(YourVar.x,YourVar.y); //if the functions expect x and y or: SetPositionToMove(Point2(YourVar.x,YourVar.y)); //if it expects a ...


1

Refactoring is your friend !!! Separate the issues and try to get your code as generic as possible. Separate and factorise the steps of the computing. Keep comments short. • Boilerplate : // ------------------------ var g = 9.81; //Gravitational acceleration var v = 35.9; //Experimantally measured arrow speed var sqrt = Math.sqrt, atan2 = ...



Only top voted, non community-wiki answers of a minimum length are eligible