Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

  • Days Won


kensarto last won the day on June 26

kensarto had the most liked content!

Community Reputation

6 Neutral

About kensarto

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. kensarto

    Making a Unity Dialog System

    Correct me if I'm wrong and have missed something but both of those products and the video seem to be based around game design, documentation, and flowchart management etc with relation to systems like dialogue, story and game events. Is there actually dialogue managers, i.e. actual components of the game itself for dialogue management, just like a character controller and camera controller, in these products or have I correctly assessed them as design tools. If these tools do indeed have working dialogue managers, could you direct me as to how to find them, as I must have missed them. Additionally, though it doesnt matter extensively since the languages are similar and i can more or less read both i have realised that i tagged this topic incorrectly as c++ instead of c# as i usually do via misclick. Just thought I'd make mention of it in case it helps.
  2. kensarto

    Making a Unity Dialog System

    Perfect, thank you. will watch the GDC first and then follow that up by examining both of those products.
  3. I'm looking for pointers before I get started developing one from scratch, I do not have, or plan to spend money on other peoples scripts or products to import into my project which means I can neither see how they do it, nor use their systems directly. As such, this will be entirely hand written to match what I need. The specifications are as follows: Unique Actors that prompt different conversations, whether that be an NPC conversation, or the interaction with a work station and selecting options. Branching conversation paths (and therefore a method of storing variables to short and long term store flags for different states) Localised scripts. I do not want to have 3 or 4 different scripts on every object just for this, it would be optimal in my opinion to have a single dialog manager script, but i will be happy if i have to include an "actor" script on the different NPCs along with that. UI (arguably the easiest of the requirements that will sort itself out when I've got everything else working over time) Is there anything obvious I'm missing about functional requirements, non-functional requirements? What is the best place to get started?
  4. I am using 3D unity. Ill post an image of the scene so you can see exactly what i am working with. my UI is all rendered using the canvas as a screen overlay which i would imagine means 2d space.
  5. If you were saying to keep my script identical except to replace all instances of the mouse position with that value of v3. Then after just attempting it I can say it does not work. The values shoot off to the negative hundreds in the y component and further than -1200 in the x component meaning that as soon as the menu is opened it is immediately closed. If this was not what you were intending could you elaborate please.
  6. RectTransform rect = RCPanel.GetComponent<RectTransform> (); float width = rect.sizeDelta.x; float height = rect.sizeDelta.y; float distanceLeft = Input.mousePosition.x - (RCPanel.transform.position.x - width/2); float distanceRight = Input.mousePosition.x - (RCPanel.transform.position.x + width/2); float distanceTop = Input.mousePosition.y - (RCPanel.transform.position.y + height/2); float distanceBottom = Input.mousePosition.y - (RCPanel.transform.position.y - height/2); //Debug.Log (Input.mousePosition.x + ", " + Input.mousePosition.y); Debug.Log (distanceLeft + ", " + distanceRight + ", " + distanceTop + ", " + distanceBottom); if (distanceLeft < -10) { RCPanel.SetActive (false); } if (distanceRight > 10) { RCPanel.SetActive (false); } if (distanceTop > 10) { RCPanel.SetActive (false); } if (distanceBottom < -10) { RCPanel.SetActive (false); } I am currently using the following script to determine whether the mouse is within 10 units of the mini menu (RCPanel stands for right click panel, i.e. the panel that i want to open when i rightclick). Mathematically it makes sense but there appears to be a flaw in my logic somewhere in the calculation of the 4 distance variables that I believe has something to do with the canvas scaling or conversion between mousePosition in real space and canvas space. How can I account for the differences so that regardless of screensize or canvas size, the calcuation works correctly. Image provided below of how the mouse doesnt sit where it says it should be sitting. (distance left states a value of 10, but the mouse was positioned just barely to the right of the left border, which should produce a number between 0 and 1 units roughly) (had to redraw the cursor position in to show where it was since it wasnt captured)
  7. Looked into Spherical Coordinates, found a set of classes that do exactly what I'm after. for now the thread is resolved since it is working but ill definitely need to study over this for a while until I am able to make a few changes. It currently doesnt go directly overhead and ive realised i might want to limit the camera to slightly above directly parallel so that you cant see the skybox under the world. But other than that thanks for the pointers again Zakwayda.
  8. Visually that is what I am after, however I am using keyboard controls not mouse controls for the camera so the math shown in this video isn't of much use to me. I will look up examples of Azimuth elevation and distance after i finish waking up. If i have no luck your last statement may have clicked a switch as to how it could work. Rather than rotating around one of the three major axis, i find the axis i need to rotate around, which will likely be much more complicated than (1,0,0) for obvious reasons. But once i find that axis, i can rotate around it in a simple fashion, no percentages needed. Just an assumably quick vector calculation.
  9. The desired result: A camera that follows a player or object as it moves, doesn't automatically rotate with the object's own rotation. Is capable of orbiting around the player's Y axis via left and right arrow keys. Is capable of orbiting around the player's X and Z axis to produce a change from top down to side on view via the up and down arrow keys regardless of current rotation around the Y axis. Is clamped to only being able to go directly above the player or directly horizontal to the player so that the player does not become upside down or the map invisible as it is viewed from underneath. Zooming with the scroolwheel also desired. Currently Completed : Rotation around Y axis transform.RotateAround (player.transform.position, Vector3.up,2*Input.GetAxis("Horizontal")); Following the player's position without being a child of the player (thus avoiding auto following player model rotation). playerMoveOffset = player.position - playerPrevious; //all Vector3 variables, work out difference between player position now and previous transform.position += playerMoveOffset; //transform belongs to camera, move camera equal to amount player moved since last update playerPrevious = player.position; //set latest player location The issue: I have only managed to get the up and down motion working on a single axis at a time, rotating around the Y axis and attempting to rotate both axis at the same time to give the proper effect becomes skewed due to the difficulty in managing the different euler values, quaternions and other nonsense that one has to deal with when manipulating unity rotations. The concept was to determine the ratio between X axis rotation and Z axis rotation needed to get a clean vertical line from any angle, then multiply the speeds of those rotations by that ratio. I came very close with the following var x = UnityEditor.TransformUtils.GetInspectorRotation(gameObject.transform).x + 180; // value from 0 to 360 var y = UnityEditor.TransformUtils.GetInspectorRotation(gameObject.transform).y + 180; // value from 0 to 360 var z = UnityEditor.TransformUtils.GetInspectorRotation(gameObject.transform).z + 180; // value from 0 to 360 var zMod180 = z % 180; //values from 0 to 1 are positive, values form 1 to 2 are negativet var zMod90 = z % 90 ; //determines % of forwards:left backwards:right Debug.Log (zMod90); transform.RotateAround (player.transform.position, Vector3.left,(90-zMod90)/90*2*Input.GetAxis("Vertical")); transform.RotateAround (player.transform.position, Vector3.forward,zMod90/90*2*Input.GetAxis("Vertical")); This was my latest attempt which is incorrect. I do not have, nor would it be appropriate to post my other attempts as it constitutes hundreds of lines of failed code. Assistance working out the final part of this camera script would be greatly appreciated.
  10. kensarto

    A* Pathfinding Misallignment

    You're probably correct, and shortly after my next undertaking which is to apply a model and animation to this instead of a cube, I might rewrite this code in ways I am more comfortable with, including the removal of the coroutine if possible.
  11. kensarto

    A* Pathfinding Misallignment

    Fortune favors me it seems as I did notice something by pure accident. I placed my Debug.Log for both current wyapoint and transform position inside the if statement that checks if the transform is equal to the waypoint and it never fired. After relocating it and with that knowledge in mind i realised that the transform never reached the waypoint yet the waypoint was still changing. I realise now this was due to the fact that the co-routine was being stopped and started and recalculated each update. I believe a potential fix to my problem is to only sop and start the coroutine each time the target is moved i.e. each time the player left clicks to move. As once i changed the method call from update to start (i.e. only once) the player moved exactly to each waypoint and stopped exactly on the tile. Thank you for suggesting this as it led to what I believe may be the solution.
  12. kensarto

    A* Pathfinding Misallignment

    I am happy to try this, logging the transform positions vs the waypoint position and the values etc, before I do however I would like to ask, what am I suppose to be looking for when I do. I'm going to assume that the values for transform will be wrong eventually as that is visibly the case, but I'm unsure as to how that can then lead me to a clue. It seems like all that would do is provide written evidence of what is already visually apparent. So I guess I'm asking, what should I be looking for when I do this to find out what is actually wrong. I will start it now and get some values to look at in the mean time.
  13. kensarto

    A* Pathfinding Misallignment

    I believe the range error is coming from the fact i have the pathing being requested every update, and when the player thinks it is at the target position, the number of waypoints is 0, thus the list has 0 entries and my code still attempts to access it at least once, a poor programming practice stemming for sure, but im assuming unrelated to the problems that occur when the program is actually doing something. The white square is off centre for the very very first attempt purely and simply because its placed poorly, i fixed that just now by changing its transform. When i left click it sets it to the centre of the square i click on but the scene itself it was placed wrong. (-3.99, 4.08 instead of -4,4) i do know for a fact that the waypoint positions all lie at the exact centers of cells. I can prove this with the following: first the centre of each tile is at an exact X,Y coordinate where x and y are whole integers, either negative or positive. They were all placed manually and it took some time so i know i didnt miss any. the waypoints use the world coordinates starting at 0,0 and spreading outwards a total distance of 1 unit per node, this is because the node radius is 1, something i can change if i desire smaller nodes etc. I will attach an image of the nodes in the scene view showing how they sit directly above the tiles. finally in my code i have tested what unity thinks the coordinates of the waypoitns are with debug.log in a few places, it is one of the first things i checked. unfortunately your statements in the first paragraph go over my head a certain degree when you talk about epsilons, but for the former part of that paragraph where you mention overshooting the target position, all I will say is that the program only ever undershoots, so unless I'm missing something (and do tell me if I am, i'm still a rather new unity developer) a chance for overshooting a position shouldn't result in undershooting it instead. I can attempt to fix the arrayindex out of range issue now, it will be as simple as making sure the list has at least 1 entry before beginning the loop, if it fixes the issue I will update this thread immediately.
  14. kensarto

    A* Pathfinding Misallignment

    IEnumerator FollowPath() { Vector3 currentWaypoint = path[0]; //Debug.Log (currentWaypoint.x + ", " + currentWaypoint.y); //Debug.Log (transform.position.x + ", " + transform.position.y); while (true) { if (transform.position == currentWaypoint) { targetIndex ++; if (targetIndex >= path.Length) { yield break; } currentWaypoint = path[targetIndex]; } transform.position = Vector3.MoveTowards(transform.position,currentWaypoint,speed * Time.deltaTime); yield return null; } } This is the code for following the waypoints grid to grid. as previously mentioned i've checked each waypoint as you can see with the commented debug.logs as well as another that im currently using elsewhere in the code. the most relevant line is "transform.position = vector3.movetowards(transform.position, current waypoint, speed*time.deltatime)" which literally and assumably simply moves the players transform position towards the position of the waypoint, and each iteration of the while loop it changes to the next waypoint and moves towards it again and again until it reaches the final waypoint in the list of waypoints. This should show off the path following, the lack of approximation or smoothing, and the method it determines if it has reached the target.
  15. Getting a bit desperate, not knowing what to do as this is a topic I've only just dipped my feet into and so far attempts at getting assistance directly on the Unity Scripting forum has proved fruitless and attempting the gamedev reddit failed because of my decisions in how I tried to share the project while it was on the first page of results. https://drive.google.com/drive/folders/1so24aSUCRWSRynpEo8ZLGNdKHkncQ589?usp=sharing Above is a link to my unity project. It is a bit muddled up as I have been messing around with it for a while now, but amongst the assets are a series of scripts which should produce a path finding effect. Essentially a Seeker finds the most efficient route, while avoiding obstacles to the target and then follows the nodes to reach the target. The issue I am having is that while for the most part it sticks to the grid, after a short time it will move itself from the centre of each tile/node and will deviate to the point where it doesn't even reach the target before it stops completely. The goal is to have a Runescape style of movement, click on the tile walk to that tile and stop, and development of anything resembling a game can't begin until I can safely move a player around accurately. If someone could tell me what is wrong with the scripts (I suspect the unit.cs script personally but can't confirm) and how to fix it so that it works as intended that would be great. So far the only advice I've been given is to use Debug.Log on different values to make sure they look right, which I already did to check the waypoints are being represented correctly (which they are) among other things. https://www.youtube.com/watch?v=HtdQOSfpRc8&feature=youtu.be I have also attached a youtube video showing how it will arbitrarily sit perfectly on the target in the centre of the tile and not do that under different conditions.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!