Quantcast
Channel: Latest Questions by dhendrix
Browsing all 42 articles
Browse latest View live

Choosing between different weapon prefabs at runtime

Lets say we have a player with three weapon slots, and a whole lot of weapon options in the game, and each one fires/works quite differently. Naturally, we give each weapon a script. The player has 3...

View Article



Assigning prefabs to player script properties at runtime

The player object has a script attached to it which contain 3 public variables, representing three different weapons the player can use. The weapons are many different prefabs which will constantly...

View Article

Shooting a projectile forward in 3d space

If I have a cube facing a random direction, how can I make it shoot a projectile in it's "forward" direction?

View Article

Spawning an object on the right side of another object

How would I go about getting the right (or left,top,bottom) side of an object, so I can create/place an object using those coordinates? The trick is this needs to work regardless of the object's...

View Article

Arcade Physics and colliders

I'm doing a top down space shooter type game, and I need the player to react to everything in different ways.For walls, collide and stop movement (unity handles this well with a primitive collider for...

View Article


Restricting movement on an axis from physics

I want enemies and objects to not move on the y-axis on account of physics, but I want to still be able to move them at will, such as in their update method. So I may want an enemy to move up and down...

View Article

Scrolling camera in Shoot 'em up

Alright, this has been bugging me for a while. In a platformer, a scrolling camera is easy to implement, just have the camera slowly move to the left(or right) and force the player within the camera's...

View Article

Collision while rotating around an object

While rotating an object around another, I have noticed the rotating object(which is using a Character Controller) does not collide with objects. I can only assume this is because the physics system is...

View Article


Preventing player from moving out of Camera Viewport

I thought I had this figured out, just use ViewportToWorldPoint to get the world coordinates of the edges of the screen, then compare the player's position to these points and move him if necessary (...

View Article


Image may be NSFW.
Clik here to view.

Getting position where raycast goes offscreen

Is it possible to fire a raycast in a direction, then get the position when the raycast hit the edge of the screen in world coordinates? For example - Let's say this is a 2d game and the black circle...

View Article

Image may be NSFW.
Clik here to view.

How to create "soap bubble" graphic effect?

Some reference pics :And more reflective:Any ideas? My initial thought was particles, but it seems they would be too detailed and involved for a particle renderer. Would it be better to use a mesh with...

View Article

PC Games determining graphic settings upon initial run

When a player runs most PC games for the first time, the graphic settings are automatically set for him, according to a rough estimate of what his computer can handle. So if his computer is high end,...

View Article

Is it necessary to use multiple materials when I only want to change one part...

If a model has two colors and I only want to change the tint of one color while leaving the other color completely unaffected, do I have to use two materials - one for each color? I know that using...

View Article


Toony Lighted shader only partially affected by light

The default "toony-lighted" shader in Unity is great, but the problem is that objects are either entirely affected by the light, or not affected at all when they are not in the light's direct area.Is...

View Article

Image may be NSFW.
Clik here to view.

Finding difference between gameObject's x coordinate according to one...

Okay, forgive the crude illustration, but it's the best way to demonstrate my problem:The black boxes are gameObjects, and the red dots are their transform's origin. Likewise the arrows demonstrate...

View Article


Getting a reference to a class created in a different gameObject (Javascript)

In a script in Object A I do the following:var prefab : GameObject; var myObj : CustomGameObject; var temp : GameObject = Instantiate (prefab, transform.position , transform.rotation); We'll call the...

View Article

Homing Missiles

How can you do homing missiles like in this video?I've tried the code from the SmoothLookAt script, but it sends the missiles in the up or down direction when I would like them to be constrained to one...

View Article


Image may be NSFW.
Clik here to view.

Indirect Missile Path

Okay my last question didn't get exactly the answer I was looking for, so I'm going to be more specific. I want to have a projectile that travels towards a given target point that may or not be...

View Article

Restricting movement to one plane, but smoothly switching what plane that is

I feel like this has been answered before, but I can't find it anywhere.I know how to restrict movement for a 2.5d platformer, but how can you make so that at certain points the plane of movement...

View Article

Direction of rotation when using Quaternion.Slerp

Given two quaternions how can you find the direction(right or left)an object would rotate when using Quaternion.Slerp?

View Article
Browsing all 42 articles
Browse latest View live




Latest Images