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.

geckoo

Moderators
  • Content Count

    2,818
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by geckoo

  1. geckoo

    Vector3.lerp

    I use a condition to create a smooth effect between idle and "crouch" positions. In fact I use function Vector3.lerp, but it didn't work and crouch is immediate. I forgot something? Thank you for help ++ if (!crouched){ // Create a breath effect in idle state/no crouch // DuckMov += Time.deltaTime * 5f; camHolder.transform.localPosition = Vector3.up * 0.8f; // Mathf.Sin(DuckMov) * 0.012f; }else{ timeToCrouch = Time.time; timeToCrouch += Time.deltaTime / duration; camHolder.transform.localPosition = Vector3.Lerp(Vector3.up * 0.8f, Vector3.zero, timeToCrouch); // Vector3.zero; }
  2. The wall is great. Thank for sharing ++
  3. geckoo

    new fps camera

    I don't know if you ask us a question or if it's just a comment. It seems to me you need help... OK. I use a method to directly disable material of my character if bool Local is true. I think my project is different, but maybe you can understand something. Code works like this : public void SetModelVisibility(bool visible){ // define material for each team if (theNetwork.gameSettings.teamBased){ if (thisPlayer.team == 1){ transform.Find("SoldierX/armorArms").renderer.material.color = Color.magenta; transform.Find("SoldierX/armorBody").renderer.material.color = Color.magenta; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.material.color = Color.magenta; } if (thisPlayer.team == 2){ transform.Find("SoldierX/armorArms").renderer.material.color = Color.cyan; transform.Find("SoldierX/armorBody").renderer.material.color = Color.cyan; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.material.color = Color.cyan; } } if (!visible){ //hide our player to himself transform.Find("SoldierX/armorArms").renderer.material.shader = oShadow; transform.Find("SoldierX/armorBody").renderer.material.shader = oShadow; transform.Find("SoldierX/head").renderer.material.shader = oShadow; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.materials[0].shader = oShadow; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.materials[1].shader = oShadow; // we know the material, but cache it if (gunMesh1.renderer){ gunMesh1.renderer.material = artillery.gunTypes[handGun].gunMaterial; gunMesh1.renderer.material.shader = oShadow; } if (gunMesh2.renderer){ gunMesh2.renderer.material = artillery.gunTypes[holsterGun].gunMaterial; gunMesh2.renderer.material.shader = oShadow; } }else{ //show the player to me transform.Find("SoldierX/armorArms").renderer.enabled = true; transform.Find("SoldierX/armorBody").renderer.enabled = true; transform.Find("SoldierX/head").renderer.enabled = true; transform.Find("SoldierX/Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head/soldierHelmet").renderer.enabled = true; if (handGun>=0 && gunMesh1.renderer) gunMesh1.renderer.material = artillery.gunTypes[handGun].gunMaterial; if (holsterGun>=0 && gunMesh2.renderer) gunMesh2.renderer.material = artillery.gunTypes[holsterGun].gunMaterial; } if (firstPersonGun != null && thisPlayer.local && firstPersonGun.renderer && handGun>=0){ if (!visible){ firstPersonGun.renderer.enabled = true; firstPersonGun.renderer.material = artillery.gunTypes[handGun].gunMaterial; }else{ firstPersonGun.renderer.enabled = false; } } } In fact I use a shader to create a shadow with a mesh without material, but you can change the method and only disable renderer : transform.Find("SoldierX/armorArms").renderer.enabled = true; transform.Find("SoldierX/armorBody").renderer.enabled = true; transform.Find("SoldierX/head").renderer.enabled = false; I can see the body and arms, but head is invisible ++
  4. Application.targetFrameRate = 60; http://docs.unity3d.com/Documentation/ScriptReference/Application-targetFrameRate.html The web page which Connor Gibson gave you is interesting to increase performances ++
  5. For a 7dFPS project a guy has created a strange game. ASCII characters fight against player and result seems to me really strange. I like to discover works which have been developed during these sessions 7dFPS. We can learn many things. This boy has smoked some illegal grass no? on Youtube ++
  6. For each value a RPC function? Ok I understand. I must rewrite this part of code. You're right - will be better. A last question. is there a means to see in Unity the bandwidth? We can use a tool? Thank ++
  7. I want to understand. In this code I use a RPCUpdate function only if one from five parameters has changed - camAngle, moveVec, crouched, yMove and health. I actualize all parameters in this case. OK I can reduce this, but I need actualize camAngle, moveVec, crouched, yMove. How I can keep a good relation clients/server if I change this? Sorry but I don't understand. Can I simplify this process if I use rpcCamtime = Time.time + 0.05 ? I need to read a simply code - an example. Do you have? Thank ++
  8. I don't know if this function will be better than this RPCUpdate method. In my project all players play simultaneously without problems. I am ready to change this part of code, but do you think I can save a importante network bandwidth or maybe difference will be not significant?
  9. if (camAngle != lastCamAngle && Time.time>rpcCamtime) sendRPCUpdate = true; if (moveVec != lastMoveVector) sendRPCUpdate = true; if (crouched != lastCrouch) sendRPCUpdate = true; if (yMove != lastYmove) sendRPCUpdate = true; if (thisPlayer.health != lastHealth) sendRPCUpdate = true; if (theNetwork.broadcastPos){ theNetwork.broadcastPos = false; sendRPCUpdate = true; } lastCamAngle = camAngle; lastMoveVector = moveVec; lastCrouch = crouched; lastYmove = yMove; lastHealth = thisPlayer.health; if (sendRPCUpdate){ theNetwork.SendPlayer(thisPlayer.viewID, transform.position, camAngle, crouched, moveVec, yMove, handGun, holsterGun, transform.up, transform.forward); sendRPCUpdate = false; rpcCamtime = Time.time; } (...) Sure friend! We need compare the last values and if we have some difference, sendRPCUpdate = true; In other case, we don't do anything - sendRPCUpdate = false; I think this functions work fine. What do you think about this?
  10. geckoo

    meta file

    Thank you for this explanation.
  11. //-------- Network gameplay stuff ---------- public void SendPlayer(NetworkViewID viewID, Vector3 pos, Vector3 ang, bool crouch, Vector3 moveVec, float yMove, int gunA, int gunB, Vector3 playerUp, Vector3 playerForward){ //send out a player's current properties to everyone, so they know where we are networkView.RPC("SendPlayerRPC", RPCMode.Others, viewID, pos, ang, crouch, moveVec, yMove, gunA, gunB, playerUp, playerForward); } [RPC] void SendPlayerRPC(NetworkViewID viewID, Vector3 pos, Vector3 ang, bool crouch, Vector3 moveVec, float yMove, int gunA, int gunB, Vector3 playerUp, Vector3 playerForward, NetworkMessageInfo info){ //received a player's properties, let's update the local view of that player lastRPCtime = Time.time; for (int i=0; i<players.Count; i++){ if (viewID == players[i].viewID && players[i].fpsEntity != null){ players[i].lastPong = Time.time; players[i].fpsEntity.UpdatePlayer(pos, ang, crouch, moveVec, yMove, info.timestamp, gunA, gunB, playerUp, playerForward); } } } Like this I think it's more understandable ++
  12. geckoo

    meta file

    What is utility of meta files which had been created when project compiled in unity? I erase it each time, but maybe I make a mistake. Must be conserved?
  13. I don't update animations by RPC. Why do that? I Use a simply correlation in LocalMode. But you need use Broadcast to distribute new pose/statut (in example a boolean) ++ if (thisPlayer.health>0f){ if (yMove == 0f){ if (moveVec.magnitude>0.1f){ if (crouched){ animObj.animation.Play("soldierCrouchRun"); }else{ animObj.animation.Play("soldierRun"); } if (Vector3.Dot(moveVec, lookDir)<-0.5f){ animObj.animation["soldierCrouchRun"].speed = -1; animObj.animation["soldierRun"].speed = -1; }else{ animObj.animation["soldierCrouchRun"].speed = 1; animObj.animation["soldierRun"].speed = 1; } }else{ oDead = true; if (crouched){ animObj.animation.Play("soldierCrouch"); }else{ animObj.animation.Play("soldierIdle"); } } }else{ if (yMove>0f){ // animObj.animation.Play("soldierLanding"); }else{ animObj.animation.Play("soldierFalling"); } } (...) ///////////////////////////////////////////////////// public void UpdatePlayer(Vector3 pos, Vector3 ang, bool crouch, Vector3 move, float yMovement, double time, int gunA, int gunB, Vector3 playerUp, Vector3 playerForward){ transform.position = pos; camHolder.transform.eulerAngles = ang; camAngle = ang; crouched = crouch; moveVec = move; yMove = yMovement; lastUpdateTime = time; handGun = gunA; holsterGun = gunB; transform.LookAt(transform.position + playerForward, playerUp); NonLocalUpdate(); }
  14. pinoykaiser - I understood RPC and NetCode in Unity through a little project which you can find here. Sure ! It's a FPS, but it seems to me not really different with your game. You need to link your objects with a NetViewer and distribute all info by Update. Your game is very pleasant with nice concept. Good luck ++
  15. This shader is so amazing that result shock me. This guy is a monster ++
  16. In fact C# and JS are so similar with Unity that I didn't ask question many time. I am using both without problem - sometimes in the same project (but it's not really recommended). I don't know Boo. In these languages just the syntax is different (or call function). I tends to prefer working with C#. Look at this explanation ++ http://wiki.unity3d.com/index.php/Csharp_Differences_from_JS
  17. geckoo

    Name above player

    I didn't know that. Thank for this advert. Thank you Beanster for this explanation. I will try ++
  18. geckoo

    camera problem

    In Unity console you can see the line code or GameObject which did'nt work. Read the red advice and detect cause of this problem. Perhaps you need to set something in inspector. I don't know...
  19. geckoo

    Name above player

    void AddPlayer(bool isLocal, NetworkViewID anID, string name, NetworkPlayer np, int targetTeam, int lives){ FPSPlayer newPlayer = new FPSPlayer(); newPlayer.viewID = anID; newPlayer.local = isLocal; newPlayer.name = name; newPlayer.netPlayer = np; newPlayer.team = targetTeam; newPlayer.lives = lives; players.Add(newPlayer);} When a new player arrive in game, this function create a new entity with many settings. I have a string "newPlayer.name". How I can use this string to create a GUItext with name of player above his head? I have found different scripts, but they don't really fun. In a multiplayer environment I have a bad result. Thank you for help ++
  20. Thank you for your words. It's for me an encouragement and a boost to continue. Can you explain to me what is a downloaded pause menu? If you want I can post the script to create a scratch with a simple line renderer. I will do that soon ++
  21. http://jeparlerusse.fr/games/lol/lol.html Finally I have updated my project. Now I use a RagDoll to create a DeathSequence which seems to me better than a simple animation without collision detection. I have "wiped out" many old parts of code and now I think NetCode works fine. GUI is OK. Don't forget ! It's not a game - just a proof of concept to create a game in the future. I work on the code and after it I will focus on the artistic material. See you later ++ Ca avance tout doucement, mais ça avance. J'ai intégré une séquence de mort plus réaliste dans le jeu. L'animation n'était pas mauvaise, mais elle ne détecte pas les collisions avec l'environnement - ce qui engendre par moment quelques pénétrations assez discutables dans le décor. Une grande partie du code a été reconsidéré afin d'être plus stable. La GUI est finie. Je pense que c'est mieux. Certes, ce n'est pas révolutionnaire, mais c'est selon moi de bonne augure ++ Я продолжаю изменять много аспектов моего проекта. Например я использую RagDoll, чтоб создать движение смерти. Мне кажется, что это лучше, чем предыдущий код. Я удалил/снимал некоторые отрывки кода, пробуя усовершенствовать отношение между клиентом и сервером. Идёт! Все в порядке. GUI закочинно. Знаю, что есть ещё много дел. Не будьте ко мне жестоки ++
  22. geckoo

    AIZombies

    You should post your script so that we can understand and solve your problem. Maybe you forgot a Tag or something like this. The shader to create the zombie disappearance seems to me very cool. Available on the web? Thank you ++
  23. geckoo

    RagDoll and physics

    Whooa! You found the solution. My problem is caused by the collider. It has been like a mortar. Thank you for help ++ PS: I must disable Character Controler... strange.
  24. It seems to me too dark ++
×
×
  • Create New...