Jump to content

coord object animation to a door


Androvikus

Recommended Posts

Hi.

I have made a door with 2 animations open and close, and put them to legazy in unity3d.

Then i created an Object with a BoxColllider on, tied my script to the Object and placed the Collider around the door. see script below:

 

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

 

public class OpenDoor_PCP_2 : MonoBehaviour

{

public enum Trigger

{

Collide,

Click

}

 

private GameObject anim2;

private Animation animation2;

public GameObject t;

public GameObject target;

public Trigger trigger;

public bool state = false;

public AudioClip OpenSound;

public AudioClip CloseSound;

 

void OnMouseDown()

{

float distance = Vector3.Distance(target.transform.position, transform.position);

 

if (state == true)

{

CloseInstance();

}

 

else if(trigger == Trigger.Click && distance < 2.5f)

{

EnterInstance();

}

}

 

void EnterInstance()

{

Debug.Log("Open Sesame");

 

anim2 = GameObject.FindGameObjectWithTag ("OpenDoor_PCP_2");

animation2 = anim2.GetComponent();

animation2.animation.Play("OpenStyleA");

 

 

audio.clip = OpenSound;

audio.Play();

 

t = GameObject.FindGameObjectWithTag ("OpenDoor_PCP_2_1");

t.collider.isTrigger = true;

state = true;

}

 

void CloseInstance()

{

anim2 = GameObject.FindGameObjectWithTag ("OpenDoor_PCP_2");//AndersPrisonDoor

animation2 = anim2.GetComponent();

animation2.animation.Play("CloseStyleA");

 

audio.clip = CloseSound;

audio.Play();

 

t = GameObject.FindGameObjectWithTag ("OpenDoor_PCP_2_1");

t.collider.isTrigger = false;

state = false;

}

}

 

 

I looged in and could open and close the door with sound. All perfect, so i thought!

 

Then i logged in with a new instance, so i had 2 players out, looking on the same door. When 1 of the players opened the door, the other player only saw a closed door?

 

I looked around for a solution, but the only thing i found was 2 tutorial on Coordinated Effects, but none showed how to do a "coord object animation" to the door.

 

So i dont know how to do a coord objecty animation to my door, andd i dont know how to coonect one to my door.

 

So thats what i want to know how to do!!

PLEASE HELM ME!!!!!

Link to comment
Share on other sites

yup, you need to synch network the door animation so other players can see, the way you have is only client side, so no multiplayer feature.

 

I wish atavism devs can build a plugin for miselaneus networking stuff, where an object can easily be networked acrossed the network and synch animations and waypoint settings ie: door like yours without to be an actual mob or npc or ie: moving platforms too. etc..

 

not sure if handling the door as an actual npc or mob and disable patroling and disable killable etc... might work, not sure but you can give it a try and post results here.

 

cheers

Link to comment
Share on other sites

  • 2 weeks later...

We are adding a state system to objects so you can basically set what state a object is in so say for instance open door or closed door or locked door. Then that will be shown and set for all players who looks at it or try and use it. It also allows for triggers and so forth. As soon as that's done it will be made into a tutorial.

Link to comment
Share on other sites

To expand on this, we are looking at adding an interactive object system to atavism in one of the next couple releases which will be used for keeping track of states on the server for these objects. I'm quite excited about it as it means you can have a real interactive world with players clicking on things or altering the states of objects that others will see etc.

Link to comment
Share on other sites

very nice, something like this i was wishing for, will make the kit more robust.

 

as well as moving platforms plugin too, aswell as a waypoint system plugin that can work with them and npc to make them move or patrol to pre set paths including path loops. this will enhance the kit a lot.

hopefully this last 2 are aswell in the roadmap too

thank you

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recommended Cloud Solution


    ksweb.net

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.