Ok Im trying to make a TALL pile of objects, ideally where the outer layer/ones touchable by the user on ground level have rigid bodies and are able to be moved.
Ive succeeded using https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=2ahUKEwjem72Awa3eAhWKEZAKHbHMCBcQwqsBMAB6BAgGEAQ&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPJBPCnuaqIo&usg=AOvVaw1ewMypDbMyIV-qz8LZoo2e to make a shallow pile of objects that can move around, but no matter how many objects I drop in play mode, they inevitably bounce off each other and distribute out on the ground.
I need a TALL pile that won't all collapse - reducing polys as much as possible for gameplay, whats the best way to do this? Is there a way to use a particle system like I did with blender and a premade object:
How is this typically done in unity?
You will want to stack them in your scene, enter play mode, let them fall and come to rest then just keep going back and forth. Once you have a good stack. Clear all the random debri, then create an empty and drag all the items into it in the inspector scene view, then you can make the empty into a prefab and set pikes wherever you want.
Alternatively you can remove there rigid bodies and parent them to an empty and just add a simple block collider(if you don't want the column to come apart)
Related
I am thinking of building a game like the sims and was thinking of how I could make the characters interact with any object without having to systematically change the character's code and prefab whenever I decide to add new furniture and props to the library. I have had an idea that consists of having my animations attached to the furniture itself rather than having it attached to the character (which would require a lot of memory and extra code if we had a lot of furniture in the game library!). I was thinking about it and had in mind that I could add a rig skeleton in Blender that has the desired animation(s) but not rig any specific object - so that I only have the animation, the location, rotation and scale of the bones! and since the characters' rigs are the same as the skeleton's rig in the furniture's animation, they could be compatible!
I hope this makes sense...
The thing is that I realise at this stage that I do not know the Animation class very well, and I am not sure if / how I can use the animation attached to the furniture to make my character interact with it...
Can Animation.Play() take multiple arguments apart from the animation to play and the play mode? Is it possible to specify which object has to play the animation? I am talking about doing all of this from the script - I write in C# by the way... and I might attach the script to the camera so I hope the script does not have to be necessarily attached to the character prefab in order to play the animation... Though I don't mind creating a function in the character's script if necessary!
I am not new to Unity but I have mostly been using cars and character controllers, so I haven't dealt with much animation coding yet...
I thank you in advance for your help and apologise for my weird english - I live in France! ^^
Mecanim performs retargeting of humanoid animations, so for what concern that specific case, you should be able to use the same rig and set of animation clip on different models.
For what concern grabbing furniture, you don't need the object to be rigged. You can use IK to precise move your character's hand toward the target object and then parent it to the relative joint in the hierarchy.
Basically in Unity 4.3 on 2d mode, I need to sometimes have objects (with sprites) that can move over the screen size border (left, right, top and bottom), when they pass the border, they should appear at the opposite like this image explain:
the first thing I had in mind was to just create a copy of the object at runtime, show it at the opposite side, and when the dragged object is completely out of the screen size, destroy that one and let only the other (new object) live. But probalby this is a bad way to do it, does exist a better way to achieve this result ?
Nope. You got it right. There is no way of the two halves appearing at opposite sides of the screen but being the same thing. Except maybe for some camera trickery but that would be for special effects, not for game logic.
Depending on what type of game you're making this will bring with it some mean problems. For instance the copy might collide with something where the original obviously will not. The trick is to apply all rules and effects from one instance to the other as well.
I'm looking for some idea's on how to create the 2d layout (walk path) of a game.
The tiles will be 32x32 pixels aswell as the character moving on the tiles.
I've thought of two ways currently, havn't tried any of them out yet.
The game will be shown in a window of about 400x300 or 512x356 something.. not much bigger than that where the game map itself could be bigger then 1000x1000. So only a portion of the map will be visible most times.
So here's my 2 options as far as I've thought of them.
[1]: Create the entire map at the start (which might increase the loading times but it will make it more easy to move the map around) including each object, player, enemies etc etc.
[2]: Create only the map seen and 1 tile around it (which is not visible) so I can make that one visible with a story board and remove the row / column which is out of bounds and create a column again.
Which means, If I have a room of 5x5 tiles, and I load 7x7 tiles. If I move right, I move all the tiles left and keep the player in the middle of the screen. Then I remove the far left set of tiles and create a new set of tiles on the right side, which will hopefully be done before the storyboard has finished moving.
In the second method all I have to consider is objects that are larger then 32x32. How could I best react on those.. However, this is a problem I'd like to address later.. Right now I prefer to know people's opinions and possible better methods.
I do apoligize if this question is no apropriate for stackoverflow.
Just be careful with the "load" word. Loading, means taking the data from the disk/drive and putting it memory. For that, you should load all the current world/map at once, before the game start. Trust me, you don't want to get yourself in dynamic loading stuff while the map is running.
But you only need to load the definition of your map, you don't need to create the instance of the object at that point. So you can create the instance from the map definition as the player walks... but are you really that constraint in memory? I can understand that for a game like Minecraft or Terraria where the map contains virtually millions of tiles... But for 32x32, you can consider making them all when you load the definition.
Of course, whatever the solution, you should only draw/compute/collide/update the tiles that are visible on screen.
I'm trying to pass some text between pages to a textblock. It works fine with small amount of data, but with large amount of data the page won't load.
Page 1:
NavigationService.Navigate(new Uri("/Pages/DetailPage.xaml?gameGuide=" + gameGuide, UriKind.Relative));
Page 2:
if (NavigationContext.QueryString.TryGetValue("gameGuide", out gameGuide))
guideTxtBlk.Text = gameGuide;
The data source is from a XML file which I'm downloading to Page 1.
Here is the amount of data that work:
In the level "Project Nova", after you fight the British and
escape, you must set an explosive. Make sure you clear out all the
enemies before planting it. There should be a Mosin–Nagant gun after
killing the enemies in the first room. This should help you clear out
the enemies in the second room, especially the enemies on the higher
walkways. You can shoot through the metal gratings. After setting the
explosive, shoot the highlighted beam and make your way out. As you
head out, there will be an enemy outside the door on your right and
another coming on your left. Kill these two and then sprint down the
walkway. There will be a few more enemies climbing onto the ship but
you should have no issues killing them and proceeding. A last enemy
should be up high so be forewarned. If you die at any time during this
run, you may still have enough time to make it, as long as there is
2:15 left on the timer.
Here is the one that don't work:
This is easiest to do on Recruit difficulty and is done on the level
"WMD". You will be in control of the dispatcher in the SR71 plane and
a soldier on the ground, switching between them from time to time. To
zoom in you press (LT) and to zoom out you press (RT). To command your
squad on where to go, press (A) on the location. Use (LS) to move the
cursor around the area. After you find the squad on your screen, you
will be given an insertion point that is to the east of you labeled
"1602". After you hear that vehicles are coming in from the north, you
will be told to put your team into the building labeled "Safe House".
Select the Safe House with (A). You will be put into the soldier’s
scenario to kill the enemies entering the house. After the encounter
with the enemies that entered the building, you will be put back into
the hands of the dispatcher. Make sure all 4 of your teammates are
alive on the screen. After this, select the back of the Safe House
building. To the right you will see two enemies next to a barrel.
Scroll over these enemies and select them with (A) to have your team
attack them. Directly behind them is an objective point. Select the
objective point so that your team moves to this location. After that,
you will be given another insertion point just below this one. You
will see bushes halfway between your current location and the
objective point. Select the bushes with (A) to have your team move
there (you should be 500-600 away from the insertion point).
Immediately after they have moved, your dispatch will tell you that a
large group of enemies is coming around. You will be told to hold down
(RS) to make your team go into a prone position and not be seen by the
enemies. After you get the all clear, move your team to the objective
directly in front of them and you will be given an objective labeled
"Barracks". The on screen reticule should turn red, so select the
Barracks with (A) to have them move into position. Now you will be put
back into the view of the soldier. Eliminate all the enemies found
inside of the building and be sure to be in front to take as much of
the fire that is shot at you and your teammates. At the end of all
this, you should have all four of your teammates with you. You need to
clear the last room, plant and detonate the C4 and make it through the
barracks. You will be given a new insertion point once you leave the
barracks, so guide your team there. When you have reached the second
insertion point outside of the building, you have safely guided the
squad without killing them. Make sure that while you are controlling
your team, no vehicles that drive by see you as your team on the
ground will be eliminated immediately. If they are eliminated, you
will need to restart the whole mission over.
There is a maximum length for a URI. I think it is somewhere around 2000 characters. You should probably adopt a different method to pass the data between the pages. Use a global variable, put the data in the ViewModel, or save and retrieve from PhoneApplicationService/IsolatedStorage are some options.
I'm designing a 3D game with a camera not entirely unlike that in The Sims and I want to prevent the player character from being hidden behind objects, including walls, pillars and other objects.
One easy way to handle the walls case is to have them face inwards and not have an other side, but that won't cover the other cases at all.
What I had planned is to somehow check for objects that are "in front" of the player, relative to the camera, and hide them - be it by alpha blending or not rendering at all.
One probably not so good idea I had in mind is to scan from the camera to the player in a straight line and see if you hit a non-hidden object, continuing until you reach the player. Unfortunately, I am an almost complete newbie on 3D programming.
Demonstration SVG illustration < that wall panel obscures the player, so it must be hidden. Another unrelated and pretty much already solved problem is removing all three wall panels on that side, which is irrelevant to this question and only caused by the mapping system I came up with.
What I had planned is to somehow check for objects that are "in front" of the player, relative to the camera, and hide them - be it by alpha blending or not rendering at all.
This is a good plan. You'll want to incorporate some kind of bounding volume onto the player, so the entire player (plus a little extra) is visible at all times. Then, simply run the intersection algorithm for each corner of the bounding volume.
Finding which object is at a given point on screen is called picking. Here's an XNA link for you which should direct you to an example. The idea is that you retrieve the 3D point in the game from the 2D point, and then can use standard collision detection methods to work out which object is occupying that space. Then you can elect to render that object differently.
One hack which might suffice if you have trouble with the picking approach is to render the character once as part of the scene, and then render it again at the end at half-alpha on top of everything. That way you can see the whole character and the wall, though you won't see through the wall as such.
One easy way, at least for prototyping, would be to always draw the player after you draw the rest of the scene. This would ensure that the player is rendered on top of anything else in the scene. Crude but effective.
Create a bounding volume from the camera to the extents of the player, determine what objects intersect that volume, and then render them in whatever alternate style you want?
There might be some ultra-clever way to do this, but this seems like the pretty straightforward version, and shouldn't be too much of a perf hit (you're probably doing collision every frame anyway....)
The simplest thing I can think of that should work relatively well is to model all obstacles by a plane perpendicular to your ground (assuming you have a ground.) Roughly assuming everything that is an obstacle is a wall with some height.
Model your player as a point somewhere, and model your camera as another point. The line in 3d that connects these two points lies in a plane that is particularly interesting to you, because if this plane intersects an "obstacle plane" below the height of the obstacle, that means that that obstacle is blocking your view of the player point.
I hope thats somewhat clear. To make this into an algorithm you'd have to implement a general method for determining where two planes intersect (to determine if the obstacle is tall enough to block view.)