playMaker

Author Topic: ETA on Navmesh agent  (Read 6552 times)

Kevron

  • Junior Playmaker
  • **
  • Posts: 51
ETA on Navmesh agent
« on: May 27, 2013, 04:48:29 AM »
Hi, and thanks for fantastic good work on Mecanim Animator. I have downloaded and tested the current package found here: https://hutonggames.fogbugz.com/default.asp?W1031

I am only wondering how far away "Navmesh agent" is to be released?

Best regards,
TorM

Kevron

  • Junior Playmaker
  • **
  • Posts: 51
Re: ETA on Navmesh agent
« Reply #1 on: May 28, 2013, 03:19:16 AM »
This is the script that is used to communicate to the NevMeshAgent.
Is it possible to remake it with Playmaker, or does it need some custom actions to work?


Code: [Select]
using UnityEngine;
using System.Collections;

public class Agent : MonoBehaviour {

public GameObject particle;
protected NavMeshAgent agent;
protected Animator animator;

protected Locomotion locomotion;
protected Object particleClone;


// Use this for initialization
void Start () {
agent = GetComponent<NavMeshAgent>();
agent.updateRotation = false;

animator = GetComponent<Animator>();
locomotion = new Locomotion(animator);

particleClone = null;
}

protected void SetDestination()
{
// Construct a ray from the current mouse coordinates
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray, out hit))
{
if (particleClone != null)
{
GameObject.Destroy(particleClone);
particleClone = null;
}

// Create a particle if hit
Quaternion q = new Quaternion();
q.SetLookRotation(hit.normal, Vector3.forward);
particleClone = Instantiate(particle, hit.point, q);

agent.destination = hit.point;
}
}

protected void SetupAgentLocomotion()
{
if (AgentDone())
{
locomotion.Do(0, 0);
if (particleClone != null)
{
GameObject.Destroy(particleClone);
particleClone = null;
}
}
else
{
float speed = agent.desiredVelocity.magnitude;

Vector3 velocity = Quaternion.Inverse(transform.rotation) * agent.desiredVelocity;

float angle = Mathf.Atan2(velocity.x, velocity.z) * 180.0f / 3.14159f;

locomotion.Do(speed, angle);
}
}

    void OnAnimatorMove()
    {
        agent.velocity = animator.deltaPosition / Time.deltaTime;
transform.rotation = animator.rootRotation;
    }

protected bool AgentDone()
{
return !agent.pathPending && AgentStopping();
}

protected bool AgentStopping()
{
return agent.remainingDistance <= agent.stoppingDistance;
}

// Update is called once per frame
void Update ()
{
if (Input.GetButtonDown ("Fire1"))
SetDestination();


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ETA on Navmesh agent
« Reply #2 on: May 28, 2013, 04:37:47 AM »
Hi,

 Not far :) this week likely.

Bump this thread next week, if you don't get it. thanks.

bye,

 Jean

Kevron

  • Junior Playmaker
  • **
  • Posts: 51
Re: ETA on Navmesh agent
« Reply #3 on: June 01, 2013, 10:32:58 AM »
Hi Jean,

Sorry to bump this two days earlier than you suggested, but I have some time now to work with this and wondered if you maybe already had finished the navmesh demo.

If not, I´ll just wait some more :)

Best,
Tor Martin

Kevron

  • Junior Playmaker
  • **
  • Posts: 51
Re: ETA on Navmesh agent
« Reply #4 on: June 03, 2013, 06:20:32 AM »
A little bump.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ETA on Navmesh agent
« Reply #5 on: June 03, 2013, 07:01:59 AM »
Hi,

 Yes, coming up shortly, thanks for bumping,

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ETA on Navmesh agent
« Reply #6 on: June 04, 2013, 07:08:36 AM »
Hi,

 ok, navmesh demo implemented. you need to download the pro package, since indie license will not be able to run that, so I made two demos packages now to avoid issues.

https://hutonggames.fogbugz.com/default.asp?W1031

implementing the navmesh was a challenge, because it relied on features not implemented by the default PlayMaker set of Actions ( because it only work son Unity Pro, and only for Mecanim... lots of ifs...), so I made a custom action just for synching navMesh Agents that uses Mecanim. This should cover most cases I hope.


bye,

 Jean

Kevron

  • Junior Playmaker
  • **
  • Posts: 51
Re: ETA on Navmesh agent
« Reply #7 on: June 04, 2013, 08:45:29 AM »
Thank you very much Jean, I will check it out and let you know how it works.

Best,
Tor Martin

MattyWS

  • Junior Playmaker
  • **
  • Posts: 90
Re: ETA on Navmesh agent
« Reply #8 on: July 29, 2013, 08:25:24 AM »
The latest unity update gave us NavMesh for free. :)

MattyWS

  • Junior Playmaker
  • **
  • Posts: 90
Re: ETA on Navmesh agent
« Reply #9 on: July 30, 2013, 08:24:06 PM »
Sorry to double post and bump, but I tried both packages with red errors to do with locomotion.

I was also wondering if per chance there would be any updates on the use of NavMesh in Unity Free, now that NavMesh is actually free! :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ETA on Navmesh agent
« Reply #10 on: July 31, 2013, 02:40:13 AM »
Hi,

 yes, navmesh will need a make over. I need first to polish pending work ( XML, Ultimate FPS Camera, NGUI), and then I'll deal with navmesh.

 also, can you post the errors you get? I have used navmesh with locomotion when porting mecanim, and it was fine.

bye,

 Jean

Red

  • Hero Member
  • *****
  • Posts: 563
Re: ETA on Navmesh agent
« Reply #11 on: August 10, 2013, 02:01:55 PM »
Hey there!

I know this is an older thread but since Navmesh is now available to indies (though i'm sure there are some extra features still pro-only) is this navmesh integration system going to work with an indie version if i import it?

I'd love to know and I want to say thank you for the work you're doing.

EDIT: Did some testing and I've determined that the navmesh system is working with the "set property" action without the system in there... apologies for asking this and necroposting.

I'll post a thread on how to integrate it when i've confirmed that this is working.
« Last Edit: August 10, 2013, 02:34:46 PM by Red »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ETA on Navmesh agent
« Reply #12 on: August 12, 2013, 04:56:23 AM »
Hi,

 Nice, thanks for catching up with this. don't hesitate to report features not accessible with set and get properties. I'll add them in my todos.

bye,

Jean