New answers tagged

0

I would recommend trying it Bálint's way first, because it is much easier to implement, but here is a CPU only solution. The reason you may want to go with this solution is if the extra rendering pass and CPU/GPU communication is giving you performance problems. You know the position/orientation of the Billboard and Ray, so you can do a series of Ray/...


0

When you need to do pixel perfect mouse picking with non geometric objects (e.g. sprites) it's usually better to simply let the GPU handle the pixel part. Render your pickable objects into a framebuffer with a solid, distinct color based on an index (there are 2^24 different indexes you can have, you probably won't run out of them), then simply sample the ...


0

if you want to detect collision or trigger between two object with colliders, at least one of them should have rigidBody. if you dont want physics interactions, you can make rigidBody as kinematic. then that object has to gravity or physics.... but still you can use collision detection.


0

Be sure you have something like this in your code: Game(1) { Content.RootDirectory = "Content"; sContent = Content; } In the book "Learn 2D Game Development with C#" on page 43 they left that out.


1

When equipping items, it really is best to have them be separate from the rest of the sprite. Unless there are only a handful of items in the entire game that can appear to be equipped, it takes a lot of effort to remake every animation for every item. Additionally, if the player can have multiple items simultaneously, you will need to animate every ...


0

For just converting Image's sprite To Texture use this: Image.sprite.texture And this will do the Job. Thanks @virtouso for sharing the thread.


1

// assume "sprite" is your Sprite object var croppedTexture = new Texture2D( (int)sprite.rect.width, (int)sprite.rect.height ); var pixels = sprite.texture.GetPixels( (int)sprite.textureRect.x, (int)sprite.textureRect.y, (int)sprite.textureRect.width, ...


0

To do this, you will need: 1 controller/administrator/creator object (obj_Hades in my project) 1 global variable (global.number in my project) The controller object (obj_Hades) will basically serve for you to declare the global variable (global.number). Note that a sprite contains 3 images/frames: In the controller object (obj_Hades): Be careful to ...


Top 50 recent answers are included