[QUOTE=Over-Run;44622780]No problem, Skibur added me on steam and helped me fix it :)
How exactly do I do that check? In the if statement should it be something like
if(rigid.position == transform.position) or something like that?[/QUOTE]
[code]
if( Vector3.Distance( rigid.transform.position, targetPosition ) < 0.1f ) { }
[/code]
Vector3.Distance() calls the sqrt() function internally though, so it might prove too expensive to do every frame. If not, just leave it, but if it lags you can just assume that the lerp always completes perfectly, and you don't need to do the distance check, but just a compare.
I don't personally trust Unity lerps though, maybe unreasonably. But if something depends on lerping completely, I prefer to check if it's within a range instead of exactly on that position.
[editline]23rd April 2014[/editline]
I assume the Catch() function gets called in the update loop?
[QUOTE=Asgard;44622812][code]
if( Vector3.Distance( rigid.transform.position, targetPosition ) < 0.1f ) { }
[/code]
Vector3.Distance() calls the sqrt() function internally though, so it might prove too expensive to do every frame. If not, just leave it, but if it lags you can just assume that the lerp always completes perfectly, and you don't need to do the distance check, but just a compare.
I don't personally trust Unity lerps though, maybe unreasonably. But if something depends on lerping completely, I prefer to check if it's within a range instead of exactly on that position.
[editline]23rd April 2014[/editline]
I assume the Catch() function gets called in the update loop?[/QUOTE]
That code works somtimes. It's glitchy because sometimes I get stuck in the catch look, I'm guessing because I fire the shot to pick it up and then move forward or backward so the object never reaches the 0.1 range? Not sure how to fix it.
Yeah the Catch() function is in the FixedUpdate
You should update your targetPosition to the correct position every update then.
[editline]23rd April 2014[/editline]
Oh your code does that. Try increasing the range from 0.1 to 1
Aha - this is why you show stuff to other people.
I'm not really artistic, so I have a tendency to overdo the image effects. Will tone down both dirty lens, and motion blur.
Found great article on how to optimize stuff in Unity 3D :)
[URL]http://gamasutra.com/blogs/AmirHFassihi/20130828/199134/0__60_fps_in_14_days_What_we_learned_trying_to_optimize_our_game_using_Unity3D.php[/URL]
Also second thing I should mention, Update function is called by reflection aka same way as with SendMessage("..") function. But it is cached.
Some folks found that if you use InvokeRepeating instead of Update function, stuff runs faster.
For PC doesn't really matter but for mobiles, everything counts.
[QUOTE=Asgard;44622953]You should update your targetPosition to the correct position every update then.
[editline]23rd April 2014[/editline]
Oh your code does that. Try increasing the range from 0.1 to 1[/QUOTE]
Yeah best thing to do is just increase the value I guess. Thanks for the help :)
[QUOTE=Over-Run;44623043]Yeah best thing to do is just increase the value I guess. Thanks for the help :)[/QUOTE]
0.1 is just a number I pulled out of my ass. You can change it to anything that works for you.
[QUOTE=Asgard;44623068]0.1 is just a number I pulled out of my ass. You can change it to anything that works for you.[/QUOTE]
Yeah I will play around with it anyway. Also just wondering, what is the way to handle the point to emit a shot from? Like usually you want a bullet to come out the out in a gun, how do you specify where that point is? Right now with this magic want the spells all seem to just emit from the front of the wand, but I would like them to emit from the tip of the wand.
[QUOTE=Over-Run;44623178]Yeah I will play around with it anyway. Also just wondering, what is the way to handle the point to emit a shot from? Like usually you want a bullet to come out the out in a gun, how do you specify where that point is? Right now with this magic want the spells all seem to just emit from the front of the wand, but I would like them to emit from the tip of the wand.[/QUOTE]
The magic of empty gameobjects, my friend. all an empty gameobject starts out being is a transform coordinate - you can parent it under your wand, orient it's rotations and positions locally to the wand tip, and then tell your script to fire the magic from the coordinate of the empty gameobject, either in the direction of its Z axis or in a direction you specify
[editline]17:33[/editline]
I'm using them as the source for my climb detection rays (the blue gizmos), they're parented to the player so will always shoot forwards from behind him no matter what rotation the player is at
Honestly, empty gameobjects are black magic and you should look to use them as much as possible to make your life easier
[t]http://i.imgur.com/d4hSC02.png[/t]
[QUOTE=The Rizzler;44623809]The magic of empty gameobjects, my friend. all an empty gameobject starts out being is a transform coordinate - you can parent it under your wand, orient it's rotations and positions locally to the wand tip, and then tell your script to fire the magic from the coordinate of the empty gameobject, either in the direction of its Z axis or in a direction you specify
[editline]17:33[/editline]
I'm using them as the source for my climb detection rays (the blue gizmos), they're parented to the player so will always shoot forwards from behind him no matter what rotation the player is at
Honestly, empty gameobjects are black magic and you should look to use them as much as possible to make your life easier
[t]http://i.imgur.com/d4hSC02.png[/t][/QUOTE]
Yep, I use emtpy GameObjects for parenting, positional and detecting stuff too.
Ah! Just discovered an issue in the demo I posted - didn't have the proper helper scripts in place for the PBR framework I'm using (Lux), adding them and will re-upload the demo (the setup scripts let me use some of dat fancy IBL stuff them kids are using these days ;) )
[QUOTE=The Rizzler;44623809]The magic of empty gameobjects, my friend. all an empty gameobject starts out being is a transform coordinate - you can parent it under your wand, orient it's rotations and positions locally to the wand tip, and then tell your script to fire the magic from the coordinate of the empty gameobject, either in the direction of its Z axis or in a direction you specify
[/QUOTE]
Ah great thanks, I have it semi working at the moment. I'm not sure how to do it correctly though. Since I'm using a Hydra to track hand position, I can turn the wand in any. I I want it so it shoots straight out of the tip of the wand forward but my code doesn't shoot it like that:
[CODE]GameObject lightShot = Instantiate(wandLightProjectilePrefab.gameObject, spellEmitter.transform.position, spellEmitter.transform.parent.transform.rotation) as GameObject;[/CODE]
[QUOTE=Over-Run;44624108]Ah great thanks, I have it semi working at the moment. I'm not sure how to do it correctly though. Since I'm using a Hydra to track hand position, I can turn the wand in any. I I want it so it shoots straight out of the tip of the wand forward but my code doesn't shoot it like that:
[CODE]GameObject lightShot = Instantiate(wandLightProjectilePrefab.gameObject, spellEmitter.transform.position, spellEmitter.transform.parent.transform.rotation) as GameObject;[/CODE][/QUOTE]
Just a guess, but you might be at fault here in the third part of that statement (the rotation part):
[code]spellEmitter.transform.parent.transform.rotation[/code]
from the looks of it you're using the emitter's parent's rotation to decide the direction of casting, rather than the rotation of the emitter itself?
maybe just try
[code]spellEmitter.transform.rotation[/code]
does it shoot out of the right position at least? I'm still rusty in the areas I haven't come back to since taking a long break from programming, like instantiation despite how simple it is
OK, reuploaded.
[unity]https://dl.dropboxusercontent.com/u/99106620/TestFPSGraphics.unity3d[/unity]
Toned down dirty lens, toned down motion blur, and added image-based lighting (diffuse and specular cubemaps)
[QUOTE=The Rizzler;44624207]Just a guess, but you might be at fault here in the third part of that statement (the rotation part):
[code]spellEmitter.transform.parent.transform.rotation[/code]
from the looks of it you're using the emitter's parent's rotation to decide the direction of casting, rather than the rotation of the emitter itself?
maybe just try
[code]spellEmitter.transform.rotation[/code]
does it shoot out of the right position at least? I'm still rusty in the areas I haven't come back to since taking a long break from programming, like instantiation despite how simple it is[/QUOTE]
Yeah that seemed to of worked thanks a lot :)
Just trying to fix up the levitation spell to work with it now because its giving me a bit of grief when it comes to ray casting etc.
Wondering how can I make my light spell look more appealing.
[IMG]http://puu.sh/8kxLR.jpg[/IMG]
It just looks really lifeless or something. I want a glow effect or some flare or something nice looking.
Also, opinions on my fireball spell so far?
[IMG]http://uploadir.com/u/8gm0qnpf[/IMG]
[QUOTE=KillaMaaki;44624308]OK, reuploaded.
Toned down dirty lens, toned down motion blur, and added image-based lighting (diffuse and specular cubemaps)[/QUOTE]
Much better, now...
[IMG]http://i.imgur.com/jc9Wp8I.jpg[/IMG]
It's fixeable? (Of course it's, but you know how?)
Maybe another camera, but how would you solve the lighting
I could probably just add a capsule collider to the characters so the gun would be pushed back (via raycast).
Was even thinking about making this a gameplay feature - if you're too close to a wall or enemy, you lower your gun and can't fire (for enemies, you'd have to use a weapon bash attack to knock them away, L4D style)
This is how I do singleton :D
Left AudioManager class, right is other random class
[IMG]http://i.imgur.com/yoo9DVx.png[/IMG]
That looks nasty :P why not just name your instance getter Instance? or just Get?
[QUOTE=Arxae;44631153]That looks nasty :P why not just name your instance getter Instance? or just Get?[/QUOTE]
Well, _ is quite shorter than Instance and it is more readable (atleast for me)
Released a couple of scripts on my blog to enable the command line console in Windows..
[url]http://garry.tv/2014/04/23/unity-batchmode-console/[/url]
[QUOTE=garry;44634129]Released a couple of scripts on my blog to enable the command line console in Windows..
[url]http://garry.tv/2014/04/23/unity-batchmode-console/[/url][/QUOTE]
Thank you garry. That is very helpful.
BTW Finally my next small 2D game finished with unity.
[B]The Revenge of Space Invaders[/B]
[IMG]https://lh4.ggpht.com/ZX0WgmRFZ763znkAGfytEqIxGva8uYN-cDy8H_-i_QEbqxbSHopFXX3e-HEpRaDWXzE=h900-rw[/IMG]
Available for android
[URL="https://play.google.com/store/apps/details?id=de.TamGames.TheRevengeOfSpaceInvaders"]https://play.google.com/store/apps/details?id=de.TamGames.TheRevengeOfSpaceInvaders[/URL]
I need your help guys there. I used the unity explosion framework and on my device Samsung Galaxy S3 it drops sometimes to 50 fps. That is not much bad but I don't have older devices for tests. So, I need your help andtests on your device. How is the perfomance in your device?
EDIT: Or if you want to try via webplayer first ( but please download android version. Its much harder ^^ and need reviews about perfomance :))
[URL="http://garrysmod.zulu907.server4you.de/sir"]http://garrysmod.zulu907.server4you.de/sir[/URL]
The shield is little bit shader programing ( There is the old sprite )
[vid] http://puu.sh/8iXlw.mp4 [/vid]
[QUOTE=HeatPipe;44631276]Well, _ is quite shorter than Instance and it is more readable (atleast for me)[/QUOTE]
I get the shorter part, but...... more [I]readable[/I]? WTF?
Just make PlayEffect a static function and create an AudioManager object if it doesn't exist already.
So I got climbing to a reliable level, the player snaps at an exact height to all ledges and moves themselves to the ledge if they aren't touching it
And then I totally messed it all up when I put time control in :v: I need advice
[unity]https://dl.dropboxusercontent.com/u/38815438/Time%20Control%20Testing/Time%20Control%20Testing.unity3d[/unity]
E = toggle time control R = reset level L = launch ball at boxes
The raycasting I use for climbing works fine at normal speed, but of course there are going to be problems at 20 times slower, also the physics visually 'stepping' is really evident when using this method
There are also a couple animation skipping issues I'll have to look into
Should I continue down this path of reducing Time.timeScale and negating the effects of that on just the player, or do it the other way round and modify only the objects I want to be affected by the time control?
[QUOTE=KillaMaaki;44641350]I get the shorter part, but...... more [I]readable[/I]? WTF?[/QUOTE]
Ok ok man, that is my opinion, just thought I'd show my style on this forum. Looks like it annoys another devs but I am single developer with no plan to reuse code in future. (with this project ofc)
[editline]25th April 2014[/editline]
[QUOTE=AtomiCal;44641387]Just make PlayEffect a static function and create an AudioManager object if it doesn't exist already.[/QUOTE]
I need to have this Instance in Prefab (only one prefab used everywhere), so other people can exchange sounds with another sounds, and so on, so I can't really just create object, it has to exist already.
But thanks for the tip, I am still kinda lost in with those Unity patterns. I know it is not magic but there is lots of different ways to reach same goal.
[QUOTE=HeatPipe;44643157]Ok ok man, that is my opinion, just thought I'd show my style on this forum. Looks like it annoys another devs but I am single developer with no plan to reuse code in future. (with this project ofc)[/QUOTE]
To each his own :)
Didn't annoy me, apologies if I upset you.
Certainly some virtue in typing less code I guess.
EDIT: Actually, when I'm feeling lazy, instead of using 'Instance' I'll frequently use 'Get'.
[QUOTE=Johnny Guitar;44645205][t]http://i.imgur.com/YcT1I5R.png[/t][/QUOTE]
goddamnit was it that fucking sphere again or did something else break
Maybe a stupid question, but...How many of your guys are using unity pro...Free
I would like to use it but already i bought some plugins :v
So agree if you're using a free version
And disagree for the basic version
Sorry, you need to Log In to post a reply to this thread.