Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'collide'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 1 result

  1. The plan is two make this available on PC only. Use keyboard to control the helicopter, use mouse to orbit view about helicopter. Problem: The camera is going thru the terrain, it will probably also go thru all meshes Video here shows current nasty... http://youtu.be/SeV_P2RaMoo Here is the scene showing the assets connected to the camera... https://www.dropbox.com/s/s3my1v54oem2gsx/terrainthru.PNG Here is the code .. check the attempts I have made (very badly) .... using UnityEngine; using System.Collections; public class CamMouseOrbit : MonoBehaviour { public Transform target; public float distance = 10.0f; public float xSpeed = 5f; public float ySpeed = 2.5f; public float distSpeed = 10.0f; public float yMinLimit = -20.0f; public float yMaxLimit = 80.0f; public float distMinLimit = 5.0f; public float distMaxLimit = 50.0f; public float orbitDamping = 4.0f; public float distDamping = 4.0f; private float x = 0.0f; private float y = 0.0f; private float dist; void Start () { dist = distance; Vector3 angles = transform.eulerAngles; x = angles.y; y = angles.x; // Make the rigid body not change rotation if (rigidbody) rigidbody.freezeRotation = true; } void LateUpdate () { if (!target) return; Vector3 oPos = transform.position; x += Input.GetAxis ("Mouse X") * xSpeed; y -= Input.GetAxis ("Mouse Y") * ySpeed; distance -= Input.GetAxis ("Mouse ScrollWheel") * distSpeed; y = ClampAngle (y, yMinLimit, yMaxLimit); distance = Mathf.Clamp (distance, distMinLimit, distMaxLimit); dist = Mathf.Lerp (dist, distance, distDamping * Time.deltaTime); transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.Euler (y, x, 0), Time.deltaTime * orbitDamping); transform.position = transform.rotation * new Vector3 (0.0f, 0.0f, -dist) + target.position; // Vector3 newPos = transform.rotation * new Vector3 (0.0f, 0.0f, -dist) + target.position; // newPos.y = Mathf.Clamp(newPos.y,Terrain.activeTerrain.SampleHeight(oPos),0.5f); // transform.position = newPos; // float dist1 = newPos.y - Terrain.activeTerrain.SampleHeight(newPos); // // if(dist1 < 0.5) // { // newPos.y = newPos.y + 0.7f; // } // transform.position = newPos; // Vector3 wantedPosition = transform.rotation * new Vector3 (0.0f, 0.0f, -dist) + target.position; // // //Vector3 bumperRayOffset; // Vector3 back = target.transform.TransformDirection(-1 * Vector3.forward); // RaycastHit hit; // // //if (Physics.Raycast(target.TransformPoint(bumperRayOffset), back, out hit, 2.5f) // if (Physics.Raycast(target.position, back, out hit, 2.5f) // && hit.transform != target) // ignore ray-casts that hit the user. DR // { // // clamp wanted position to hit position // wantedPosition.x = hit.point.x; // wantedPosition.z = hit.point.z; // wantedPosition.y = Mathf.Lerp(hit.point.y + 1.0f, wantedPosition.y, Time.deltaTime * 5.0f); // } // // transform.position = Vector3.Lerp(transform.position, wantedPosition, Time.deltaTime * 5.0f); } float ClampAngle (float a, float min, float max) { while (max < min) max += 360.0f; while (a > max) a -= 360.0f; while (a < min) a += 360.0f; if (a > max) { if (a - (max + min) * 0.5f < 180.0f) return max; else return min; } else return a; } } Please help ... : ( We will braai together when all this comes thru .. : )
×
×
  • Create New...