I picked up where I left off yesterday. I started by figuring out how to Instantiate a Prefab into the scene via script. Once I figured that out I moved the instance to the proper location relative to the shooter and set the rotation to align with the shooter. At this point, I almost have a base scene assembled that I can use for testing purposes.
Added a timer so the placeholders weren't spamming when testing. Added a collider to the placeholder and the 'tank', and have been trying to figure out how to make Unity's equivalent to a Msh collider to give the terrain piece a collider as well. Also working on a method to calculate the angle needed to hit the target with a force
Spent an insane amount of time in the editor once i got into the Delta build of the project. Was able to trace back enough of the code to have an understanding of the framework and get a projectile prototype up and running.
I'm having some issues with this assignment initially. In order to get down to work on the problem of units matching the rotation of terrain, i need to get some actual terrain into the game. I've spent pretty much all my time working on this part of the task so far. I'm having two separate issues. One is that the model in the build I have downloaded is crashing the game. I drag just the model into a working scene and it no longer runs the game as long as the model remains in the scene. I'm having an FBX importer error in the stack trace. The second issue i'm having is with colliders. I've have not been able to find any form of mesh collider type. A convex hull collider is only good with simple geometric shapes and is overly simplistic for the modeled terrain. I am currently working under the assumption that using a heightmap collider with a matching piece of heightmap terrain would solve this particular issue. Since i cannot get the game to run with that model in the scene anyway I'm exploring other options to test this theory. Obviously, i'm new to the project and probably missing some piece of pertinant information. I've been told that the terrain was placed in-game with a working collider at some point so I'm assuming this to be the case.
I have created a model in Blender to use as a control, exported to and FBX, imported into my scene and am having the same issue with it crashing the game when I run it. I'm going over the stack trace to try to find the problem. James do you have any experience with this you can pass along to save me some time, I feel like I'm missing something important.
I scoured the Xenko forums looking for information on the collider issue and its a common problem due the the physics system being based off the Bullet Physics library and the Xenko Developers haven't implemented an easy to use system for mesh colliders. Currently, in order to do this you have to supply the mesh data to the convex hull constructor at runtime and set it to the static collider's collider shape.
I've finished parsing the files, and have a script that loads an OBJ and parses it into a Vertex array, UV array, Normal array, and an array for vertex indices, normal indices, and UV indices. I've created a collider in code without any error but am having trouble seeing it with the debug collider visibility. Still a WIP but I have made progress. Calling it a day, for now, I need a break from this particular issue.
I worked on this all afternoon, probably could have downloaded a finished solution from the asset store but I didn't feel that was appropriate and I enjoy doing it myself more. I could probably submit it now as finished and sync project but I'm tweaking a few things. It wasn't part of the task but I'm adding terrain along with this agenda so the camera has something to raycast. Taking a break to eat. I often stay up all night as I work best during those hours so I'll be finshing this up tonight.
I have created sandbox folders in the unity project, delta branch. Within that folder, i created a personal sandbox folder and various subfolders. There is a development scene that can be opened, it contains a quick test terrain, a camera that moves with WASD and mouse at the screen edges, the camera script is set up in the unity editor, inspector panel with the main camera selected. I'm going to do more with the camera but it's far enough along to complete this task. (I been up awhile need a break before I continue.) I have checked in the changes I made with the MCU tool.
Ok, I'm turning this in for completion. The only part of the agenda I haven't finished that I am working on is highlighting units. So far I have unit selection working, the movement working, and the object avoidance working.
For debug purposes, Left Click will set the destination of an IMovable object if any are selected. Right-Click will select the clicked IMovable unit or clear the selected units if clicking on the empty terrain. Right-Click-Drag will form a selection box that blankets the terrain adds the objects in its bounds to the selectedIMovable list.
When I switched to Jonathan's terrain and mapped to the hight of the terrain everything went smoothly. I did notice when selecting an extremely large area the mesh folds in on itself. It should be something we can work around for now while I figure out the problem and limit the selectable area so this isn't an issue. If it does become an issue we can attack that problem at that time. I've setup fall back options that should be quick to implement just in case.
The task is finished and uploaded. FULLY functional on my machine at the time of upload. Created an entirely new scene and agenda folder for this as none of the work I have done previously works at all. All the scenes and prefabs are completely broke. I recommend deleting anything of mine that is not in an agenda numbered folder.
I started off by figuring out how to import models, then make them into prefabs. Then i researched how to attach a script to an Entity. I'm currently figuring out how to spawn in a projectile on demand. Also now that i have an understanding of the game engine I've started building a mock scene so I can code and test a missile being fired. At the moment I'm trying to guess how Armament is handling enemy entities and how the missile will target those enemies, either by being targeted before firing by the shooter or by tracking itself to a target it chooses somehow. Currently, due to lack of information, I'm deciding on whether to hard code a target, tag the enemy somehow and look for that tag to track to, or creating a collider zone which the first tank will 'look' into for another entity to fire at.