I am just new to Unity and programming but I have made my way through a lot of tutorials and have created a couple of basic games, 2D shooter / simple RTS game.
I am now looking into more advanced material and what I am currently try to do is creat a space based RTS game, sort of a mix between EVE and Homeworld and X3 Albion Prelude.
However moving objects in 2D is easy as you have a ground plane for your coordinates but for the life of me I just cant work out how to do 3D movements.
Any helpfull advice or tips on this area would be great, some examples from programmers who have already implemented this type of feature would be great.
3D is actually much easier then 2d with Unity I found at first. Most of 2d I had to create all the movement and scripts for that functionality.
Unity has a bunch of scripts you can download in the standard assets package. I suggest downloading that and looking at it.
For 3d you need a terrain or a plane. The easiest way to start is use cubes and add mesh agents to them. Bake your terrain and attach some movement scripts to your cubes and mess around. You will learn a ton just doing that.
Youtube search : unity movement and you’ll find a crap ton of stuff
Still really struggling with this, just cant seem to find an answer but there seems to be a few Unity members who have created or are creating a space based RTS, so looking towards your knowledge for some help. It would be appreciated.
Thanks for the reply, at the moment I dont have internet access with my PC that has unity on, so I am using the library so I cant download any unity assets.
As far as what I am struggling with is the basic point and click movement, in my ground based RTS that I created the point and click is easy as I have a ground plane so my units move to the position on the ground plane clicked.
Since there is no ground plane in a Space RTS, I am struggling to capture specific points to move the units to.
I have played with flight controls for a space ship and this works great as I either use the keyboard or mouse to move around using forces / velocity and movement, but a simple point and click so the unit will to that position just eludes me.
Ok, Well I suggest you look into ScreenPointToRay
Something like this might help you get started.
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
// create a horizontal plane
Plane plane = new Plane(Vector3.up, Vector3.zero);
float distance = 0; // Distance from ray origin (which is camera's near plane)
// if the ray hits the plane...
if (plane.Raycast(ray, out distance)){
//move the targetGameObject (your ship or whatever) to the position
targetGameObject.transform.position = ray.GetPoint(distance);
}
Hi, Druid
I love Homeworld too.
I’m also making a game like want you said and want to know HOW.
Currently I am making a research about it and realized that the points like these below:
Navigation - Unity’s NavMesh can’t work it .You need to find a way to do the path-finding in 3D-space(Such as Nav Volume?). How to make an efficient way to keep the FPS is the problem.
Movement - You can learn the Steering Behaviors(Including Seek, Flee, Arrival, Avoidance, etc…) to implement it. The hardest part is Avoidance in crowd simulation, this is almost can not be perfect.