#alright thanks X
1 messages · Page 1 of 1 (latest)
should I explain further in detail what I'm going for so get the idea?
i think i understnad
basically the same as little big planet
you're just making an emerge from (location) animation
the simplest way to do it would be w/ DoTween or a tweening library
but if u want animation its gonna take a bit of a hack
you got a few problems
- if you want the animation re-useable you can't animate the OUTER gameobject
(this locks it to teh animation in world-coordinates).. meaning u wont be able to re-use it anywhere else. unless u had an animation for each portal
- next problem is w/ the player *you dont want it always inside another gameobject if it doesnt need to be.. (so this is where we'd have to parent and unparent it before and after each animation)
- lastly.. the movement and camera are taking ur inputs... (if we animate we'd want to disable that for that brief period that we're animating)
yea, its a library that makes it easy to do basic animations and things w/ code
thing.DoMove()
thing.DoScale()
thing.DoColor() etc etc.. not sure those are the exact methods..
but its basically just Lerping and Slerping things here and there
alright thanks I will have a further look into it
im just gonna do 2 positions with (1) animation
then with the example i show u can use it over and over
so far so good lol
this was my idea..
to have an inner gameobject that we could move to different portals.. and then attach the player to the inner gameobject that would do the emerge thing..
it works but it doesn't... i've had trouble with my camera script in the past and it seems the same things happening now
close but no cigar.. this is what ive been meaning tho..
when we go into the trigger we can move the main teleporter object anywhere we want..
then the code parents the controller to the child (the thing animating)..
and u can disable and enable it and re-use it as many times as u want... (i think if i had a better camera controller this would work as it is.. but right now my rotations are getting all messed up when i teleport (and do a 180)
using UnityEngine;
using SPWN;
using System.Collections;
public class TeleportTrigger : MonoBehaviour
{
public GameObject Teleporter; // this object is the holder of the animation
public GameObject TeleporterChild; // the object that actually animates
public Transform teleportPosition; // transform of where to move the teleporter
public GameObject playerMainGO; // the player gameObject
public SpawnCampControllerLite SpawnCampControllerLite; // to disable movement
public ControllerCamera ControllerCamera; // to disable camera movement
public float animationTimer = 1; // we need to know how long the animation is so we can unparent the the controller afterwards
private void OnTriggerEnter(Collider other)
{
if(other.CompareTag("Player"))
{
// move teleporter animation's (root) to the correct portal
Teleporter.transform.position = teleportPosition.position;
Teleporter.transform.rotation = teleportPosition.rotation;
// disable movement and camera movement so we can move our player and so that our animations move it
// now we need to make player a child of the `Inner` gameobjet (the one that animates)
playerMainGO.transform.parent = TeleporterChild.transform;
// and set our position and rotation to match
playerMainGO.transform.position = TeleporterChild.transform.position;
playerMainGO.transform.forward = TeleporterChild.transform.forward;
SpawnCampControllerLite.canControl = false;
ControllerCamera.enabled = false;
// now we've moved the player to the child and we've set its postion and rotation to match it..
// we'll enable the Teleporter now so it can animate
StartCoroutine(WaitForAnimationAndDisable());
}
}
IEnumerator WaitForAnimationAndDisable()
{
Debug.Log("We Should have ENABLED The Teleporter Object.");
Teleporter.SetActive(true);
yield return new WaitForSeconds(animationTimer);
//unparent player
playerMainGO.transform.parent = null;
//restore controls
SpawnCampControllerLite.canControl = true;
ControllerCamera.enabled = true;
//disable teleporter to re-use later
Teleporter.SetActive(false);
}
}
``` no beuno tho
imma try again in a bit
i honestly think its my camera code..
and it may work with yours
b/c if i dont rotate the player to match the portal's rotation it does work lol
thank you so much, So in a nut shell I can just have 1 animation and when the player dies the player teleports back to the spawn box and replays that animation correct?
the way i have it set up
you have 1 object (the main teleporter)
it animates a child object (that does the actual moving)
soo.. anytime u want.. u can grab the OUtter object (and align it to the portal)
then parent the controller to that child that moves.. (it'll always move according to how that outter is rotated)
so i just
Move the teleporter..
Parent the controller to the child
and then enable the entire gameobject
it automatically animates the player since it got parented to that child..
once the animation is over u can unparent it.. disable the teleporter.. and just wait until u need it again
then its rinse and repeate.. (move it to the new position u want).. parent the controller to the child, enable it.. let it animat.. etc
I see this is way simpler than I thought lol
got a tooth-ache today.. its hard for me to explain what im thinkin in my head 😄
thanks again !!!! ❤❤
good luck 👍
its alright I understood
imma try to fix my camera code now that i see its really bad lol
btw if you enable this you can enter play mode faster
ya, i always forget that i turned it off tho 😄
that was a burner project anyway.. i duplicated my original one so i could code w/o breaking any of my stuff
Why does this happen? I did what you did
you have to select the child object when u animate
u can click "Add" or Create new animation on that root object.. but then select the child when adding keyframes..
I did I selected the inner to make the animation as the player is the child of inner
do I select the actual player not inner?
when u hit record u then select the child and move it..
It tells exactly which object ur keyframing
Inner: Position, Rotation, Etc
ya, u can test..
if u now select the Inner gameobject and press preview or play in the animator
you'll see it's gizmo being animated
the way your telling me to do it
ohhhhh
the whole point of the empty containers. was to animate them instead.. w/o having to put an animation o n the player at all
then if u parent it to it.. it'll just follow along..
is it like this then?
(as long as ur movement code isn't fighting it*
imma try out using DoTween instead.. as this is "simple" in theory.. but can get complicated once its all set up.. and having to move around it and then attaching the player.. and blabla
might be able to just teleport the player and then play a simple Tween for a second..
that'd be hella lot easier (in terms of work)
ok I will download dotween then 👍
have u got it working w/o animation?
like just teleporting the player and having it face the right direction?
nope never used it before lol
i'd test that and make sure thats working first 😄
no i just mean... the teleport code.. no animation at all
ohh I havent done the teleport code yet just wanted to get the animation part out of the way first
b/c if thats working it shouldnt be too bad to add the tween to it.. (if thats all working)
ohh okay
so with a tween setup its way simpler
`- Disable player control (so they don’t interfere with movement).
- Teleport instantly to the target position.
- Apply a forward tween (push effect).
- Re-enable controls once the tween finishes.`
Hey just watched some videos about dotween and its pretty cool. Should I remove the animations and the outer and inner game objects? Since im animating it by code, or will it just lock the player?
💯 that was why i brought it up
its great for animating little things like u were describing figured it be useful in other areas too..
if u dont need the old way delete em 👍
unless ur still using the containers for ur dotween or w/e
if not i'd remove em.. no need for extra stuff u dont need ;D
got it, So could I use the tween animation to play for different checkpoints?
sure u could..
since its a script instead of an animator.. u can just plug in the values u want for each place u need to use it
Thanks helpful as always ❤️👍
I have done some thinking and this is how I'm going to do it what do you think? Basically the player spawns where the respawn point is and the checkpoint saves the player spawn point so in the inspector when the player enters the box collider it will add the spawn point so the player will spawn there. Kill area teleports the player back to the spawn point and rinse and repeat you get the idea. Is this a good way to do this? just needed some one else's feedback.
i can't say if its good or not.. but what really matters is does it work for you?
do you understand it? and can you refactor it easily?
Oh yes I understand it and I have finally finished it!
I made it so it's very easy to set up and reusable so I can have loads of check points 😁
Thanks for the help DOTWEEN IS AWESOME!!
innit it..
i've recently removed it from my assets tho..
i blame it for breaking one of my really good projects
i think the installation messed up the update loop or timing..
or something i did possibly.. idk..
my friends recommended me to use PrimeTween
apparently its better for performance
Is primetween better than DOTWEEN?
DoTween is absolutely fine to use tho..
yea.. from what ive looked at.. its better
it doesn't make as much Garbage that the garbage collector has to pick up
i actually havent swapped over to it yet.. i just removed my tweens for now.. and do my own tweening in coroutines for now
problem w/ DoTween is that unless you manage it / use it specifically the way it needs to be used you'll end up with more garbage collection having to happen.. but that may not even be a problem for a smaller scale game.
you may want to read up on it yourself.. but im only switching b/c i publish assets and stuff and I have to keep Third-party Unity Store assets out of the project anyway..
and primetween is a github
ahh sht i cant use this either..
i'll have to stick to my custom coroutines
but i'll still use it for my game-stuff
yes..
and i think from what ive looked at it works almost the same as DoTween
some of the old-head (pro-level coders was talkin about how its better) but tbh i didn't understand alot of it
less garbage.. (and i dont think u have to install it like u do with DoTween)
Alright thanks for that I'm going to have a further look at prime tween
same.. i'll prolly install it here in a min
this looks fire btw
Thanks ❤️
got mine working too
Now that I've finished this I can finally start level design 🤩
this is the best part
Is this a game you're working on? Looks interesting 👀
nah its an asset i'll be givin away
and using in my YT tutorials
i wont have to start w/ a stupid little plane
and since the viewr's can download it for free.. its a nice starting point
You haven't posted in 2 years 🥲 watched some of your videos they were very helpful 👍
yea, but imma take it like a compliment.
i've learned so much since then.. and it'd be a disservice to of kept going..
now i know so much more.. and i know why other youtubers do things the way they do..
and i think i can still do a bit better.. make it easy.. yet make it re-useable and in a way that a beginner would understand
instead of bad code, quick code, copy and paste code..
and since i can make info-graphics and stuff pretty well b.c i came from being a graphic artist to being a game dev..
i think they gonna be much better production quality
