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 'vector3'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• GENERAL
• Introduce yourself
• Discussions
• Showcase
• Need help?
• Seeking team members?
• Offtopic
• RESOURCES
• Example Projects
• Scripts
• 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

### Calendars

• Community Calendar

• 0 Replies

• 0 Reviews

• 0 Views

Found 3 results

1. ## Calculate bounds of a box including rotation

Hi I working on collision system for my game i have custom colliders. I used "http://answers.unity3d.com/questions/777855/bounds-finding-box.html" to create bounding box for collisions. I am getting problem for the boxes where right and forward values have been used to create box. Otherwise its working fine. Anybody has any idea how to include right and forward vectors in calculating 8 points for the cube. Below is my code for calculating points. public static void GetBoundsPointsNoAlloc(BoxRegion bx, Matrix4x4 colliderBox4x4,Vector3[] points, Matrix4x4 mx) { Transform tr = Utils.FromMatrix4x4(ref DebugCollisionTestSphere.trans,mx); Vector3 v3Center = bx.center; Vector3 v3ext = bx.GetExtents(); Vector3 right = bx.right; Vector3 forw = bx.forward; //Quaternion qua = Quaternion.LookRotation (bx.forward,Vector3.Cross (bx.forward, bx.right)); // tr.TransformDirection (bx.forward); //tr.localRotation = qua; tr.forward = bx.forward; tr.right = bx.right; //tr.rotation = qua; points [0] = tr.TransformPoint (new Vector3 (v3Center.x - v3ext.x, v3Center.y + v3ext.y, v3Center.z - v3ext.z)); // Front top left corner points [1] = tr.TransformPoint (new Vector3 (v3Center.x + v3ext.x, v3Center.y + v3ext.y, v3Center.z - v3ext.z)); // Front top right corner points [2] = tr.TransformPoint (new Vector3 (v3Center.x - v3ext.x, v3Center.y - v3ext.y, v3Center.z - v3ext.z)); // Front bottom left corner points [3] = tr.TransformPoint (new Vector3 (v3Center.x + v3ext.x, v3Center.y - v3ext.y, v3Center.z - v3ext.z)); // Front bottom right corner points [4] = tr.TransformPoint (new Vector3 (v3Center.x - v3ext.x, v3Center.y + v3ext.y, v3Center.z + v3ext.z)); // Back top left corner points [5] = tr.TransformPoint (new Vector3 (v3Center.x + v3ext.x, v3Center.y + v3ext.y, v3Center.z + v3ext.z)); // Back top right corner points [6] = tr.TransformPoint (new Vector3 (v3Center.x - v3ext.x, v3Center.y - v3ext.y, v3Center.z + v3ext.z)); // Back bottom left corner points [7] = tr.TransformPoint (new Vector3 (v3Center.x + v3ext.x, v3Center.y - v3ext.y, v3Center.z + v3ext.z)); // Back bottom right corner }
2. ## Smooth aiming

Hi, I have a problem, I don't know how to script, can anyone teach me or give me a script that moves the camera slowly between two point for aiming please ?
3. ## Why my AI don't move?

What is wrong with this code? I'm using A* pathfinding from here Problem: NullReferenceException UnityEngine.CharacterController.SimpleMove (Vector3 speed) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/NewDynamics.cs:2768) AstarAI.FixedUpdate () (at Assets/AstarAI.cs:54) Effects: Ai not moving. Script: using UnityEngine; using System.Collections; using System.Collections.Generic; //Note this line, if it is left out, the script won't know that the class 'Path' exists and it will throw compiler errors //This line should always be present at the top of scripts which use %Pathfinding using Pathfinding; using Pathfinding.RVO; public class AstarAI : MonoBehaviour { public Transform targetPosition; private CharacterController controller; //The calculated path public Path path; //The AI's speed per second public float speed = 3; //The max distance from the AI to a waypoint for it to continue to the next waypoint public float nextWaypointDistance = 3; //The waypoint we are currently moving towards private int currentWaypoint = 0; public void Start () { //Get a reference to the Seeker component we added earlier Seeker seeker = GetComponent<Seeker>(); //Start a new path to the targetPosition, return the result to the OnPathComplete function seeker.StartPath (transform.position,targetPosition.position, OnPathComplete); } public void OnPathComplete (Path p) { Debug.Log ("Yey, we got a path back. Did it have an error? "+p.error); if (!p.error) { path = p; //Reset the waypoint counter currentWaypoint = 0; } } public void FixedUpdate () { if (path == null) { //We have no path to move after yet return; } if (currentWaypoint >= path.vectorPath.Count) { Debug.Log ("End Of Path Reached"); return; } //Direction to the next waypoint Vector3 dir = (path.vectorPath[currentWaypoint]-transform.position).normalized; dir *= speed * Time.fixedDeltaTime; controller.SimpleMove(dir); //HERE IS THE PROBLEM //Check if we are close enough to the next waypoint //If we are, proceed to follow the next waypoint if (Vector3.Distance (transform.position,path.vectorPath[currentWaypoint]) < nextWaypointDistance) { currentWaypoint++; return; } } } (Yes, it's the one who Aron gives in the A* documentation)
×
×
• Create New...