- Home /
Protected/private, KeyCode, Colliders and Large map Questions
Hey everybody !
I have some question. I'm not sure that's the correct place to ask these questions, because i don't need help or code issue, i was just asking myself about colliders, KeyCodes, ... If i'm not at the correct place, tell me and I will delete this post.
So, here are my questions :
1) How do we check what was touched after a melee attack ? With collider ? With Physics ?
2) If we make a single player game, should we use protected or private things ?
3) Can we use KeyCode to make a customisable Input manager ?
4) How can we optimise a large map ? Enable objects within a certain radius?
Thank you !
Bye, xyHeat
Answer by Zynek · Nov 04, 2016 at 04:02 PM
Hi there, about Q 1-3 everything you need to know you can find here:
Q4) You can optimise large map in many ways. If your terrain is too big you can cut it in pieces and stream it from disk when needed.
For objects you can bake occlusion culling map
Additionaly for high-poly meshes you can create a low poly meshes and put them into LOD groups. Rendering more simple meshes when they are further from camera.
Thats about basics, hope that helps.
GLHF
Thank you for your answers ! I'm now looking for these tutorials and the youtube vidéo !
Have a good day,
xyHeat
Answer by Thomas-Hawk · Nov 04, 2016 at 04:29 PM
The melee attack is something I'm working on right now too. I'm going to try to go off of the Space Shooter lesson's "Mover" code. It gets information on where to spawn from an empty gameobject parented to the player and positioned in the starting path of the attack. The player's scripts "clones" the "attack" object (I would personally rig it to the weapon's graphics), which has a "mover" script which moves it along the path or sets it on the trajectory you'd like, and then the object is removed somehow to prevent infinite objects building up, in the space shooter he used ColliderOnTriggerExit which is very dynamic.
Private variables are collected / defined and stored only for the script they are in. Public ones are accessible through Unity's interface. You can use the start function to define any in-script variables when the script starts, but setting it as public I believe stores that variable more "globally" also so other scripts can reference that variable without having to redefine it.
KeyCode, I don't think is specifically what you need. Go to Edit > Project Settings > Input. Where it says (Axes 18)- or more if you have browsed the asset store a little - adding 1 to that number clones the bottom input. Click that input, and you can set it to your key(s) of choice, even for example if you wanted Q and E as "Roll" you could put Q as the negative value and E as the positive value and use Input.GetAxis ("Roll"). Hope that helps.
Optimizing a map, I don't know. Shrug
To append: I'm new, a quick learner, but I might be wrong about all of this.
Thank you for your answer ! I will remember it all for nexts projects !
Thank you again, bye.
xyHeat
Your answer
Follow this Question
Related Questions
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
How to Use Key Combinations with the Control-Key? 2 Answers
Interacting with a button by colliding with it 1 Answer
KeyCode parse problem 0 Answers
World Map Help 1 Answer