Wednesday, July 20, 2016

P3D2



Made rough draft 2 of the design doc and fleshed out the setting.  Drew a bunch of stuff too but too lazy to scan them in for now.

Swapped out cube for Rynn's block-in model.  Decided to use velocity to determine her facing, but switching her movement to velocity made her movements really floaty.  Ended up forcing her to stop when no movement keys are pressed.  There is probably a better way and I spent a funny amount of time to get to the clunky solution :\

I eventually want her upper body to rotate towards player mouse.  Using a hacky indicator for now.  Still pretty sure it's not working correctly, but at least I learned how to use raycast to determine the world position of the mouse.  I understand zero amount of maths on this and will have to learn math again for sure.

Code Notes:

Seems like the new API convention or something (??) made a lot of short-hands like "Rigidbody" or "camera" not work.  Rather, "GetComponent<Rigidbody>()"seems to be the way to go.

transform.rotation = Quaternion.RotateTowards (transform.rotation, Quaternion.LookRotation (new Vector3 (transform.GetComponent<Rigidbody> ().velocity.x, 0, transform.GetComponent<Rigidbody> ().velocity.z)), Time.deltaTime * rotateSpeed);

Must look into Quaternion-related stuff.  Need to relearn geometry as well.

RaycastHit hit;
Ray ray = mainCamera.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
Physics.Raycast(ray, out hit);
Vector3 lookTarget = hit.point;
lookTarget.y = hit.point.y + gameObject.transform.position.y;
gameObject.transform.LookAt (lookTarget);


I'm still thrown off by the grammar of this raycasting endeavor.  Also, the LookAt seems pretty gimpy and I don't know how to control or change the "forward axis".  Might not be very usable if I want to use this to define shooting direction.  Found some complicated math stuff that again has to do with angles.  Geometry.

Next Steps:
  • Get the pointer to rotate towards mouse direction at a fixed speed
  • Spawn projectiles flying along the "front" direction of the pointer on mouse click (not necessarily towards mouse)
  • Make some environment assets that can be placed
  • Separate out Rynn's upper body so it can rotate properly instead of the pointer


Tuesday, July 19, 2016

P3D1

Venturing into 3D this time.  Picking up the game idea I had a while back, let's see how far this one gets :)

Day 1:


  • Started a new project.
  • Stole a sample scene.
  • Figured out how to attach camera to player, then swapped default player out for a cube.  Animation is for noobs super advanced people.
  • Made a movement script that includes jump.  The directional movements are currently analogue, might make that physics-based too since I'm already using rigidbody for jump for convenient gravity.
  • blocked in some assets.
  • Refresher on the tiny bit of C# I knew.


Code notes:

public KeyCode myKey = KeyCode.M;
if (Input.GetKeyDown(myKey)){
}
void OnCollisionEnter (Collision col) {
if (col.gameObject.tag == "Ground") {
isGrounded = true;
}
}

 Vector3 playerInfo = player.transform.transform.position;
gameObject.transform.position = new Vector3 (playerInfo.x + cameraDistOffsetX, playerInfo.y + cameraDistOffsetY, playerInfo.z - cameraDistOffsetZ);

Next Steps:


  • Make a less cubish player character
  • Get it to face whichever direction it moves in
  • Make it possible for the player to have a dialogue with Rynn
  • Probably figure out a rough art style??