Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mukarillo

Pages: [1] 2
1
Support / Advanced Collision with angle
« on: September 27, 2015, 07:03:13 pm »
Hi there,

I'm using Advanced Collision to make a fighting game. I've managed to compare two rects to check for collision using this code:

Code: [Select]
float originX = (currentSprite.FlipX) ? -currentSprite.CurrentSprite.customColliders[i].origin.x : currentSprite.CurrentSprite.customColliders[i].origin.x;
Rect collisionRect = new Rect(
(gameObject.transform.localPosition.x+originX)-currentSprite.CurrentSprite.customColliders[i].Size.x/2,
(gameObject.transform.localPosition.y+currentSprite.CurrentSprite.customColliders[i].origin.y)-currentSprite.CurrentSprite.customColliders[i].Size.y/2,
currentSprite.CurrentSprite.customColliders[i].Size.x,
currentSprite.CurrentSprite.customColliders[i].Size.y);

But now i'm facing another problem, i got a sprite with a 45 degree angle, like this:

But when I run that code into this kind of image, this happen:


I coudn't find a way to rotate a Rect, how can i do that?

Thanks! :D

2
Support / Re: TiledMap cannot import Object Layer?
« on: May 26, 2015, 03:28:48 pm »

3
Support / Re: Pixelated sprite blurred
« on: May 24, 2015, 11:51:17 pm »
THANKS!! ;D ;D

4
Support / Re: Pixelated sprite blurred
« on: May 24, 2015, 11:08:06 pm »
Thanks bro, it worked.
But now, in some frames of the animation, i can see lines (i guess its from the other sprites in atlas)

Here's what im talking about:


Thanks :)

5
Support / Pixelated sprite blurred
« on: May 24, 2015, 05:46:12 pm »
Hi there,

I've got a sprite that is made in pixel art, but when i create a tk2dSprite, it's kinda blurry. There's a way to get the real image in-game?

Here's a example:


Thanks!

6
Support / Re: Detecting collision between 2 Advanced Collider
« on: May 23, 2015, 04:06:40 pm »
Im sorry for double posting again, but i figured it out how to get the collider in a rect:

Code: [Select]
new Rect(
(gameObject.transform.localPosition.x+currentSprite.CurrentSprite.customColliders[i].origin.x)-currentSprite.CurrentSprite.customColliders[i].Size.x/2,
(gameObject.transform.localPosition.y+currentSprite.CurrentSprite.customColliders[i].origin.y)-currentSprite.CurrentSprite.customColliders[i].Size.y/2,
currentSprite.CurrentSprite.customColliders[i].Size.x,
currentSprite.CurrentSprite.customColliders[i].Size.y);

Now all i got to do is to
Code: [Select]
Rect.Overlap and manage the collider names.

Thanks Unikron! your asset rocks! ;D

See ya!

Edit:

Haha, sorry for bothering so much, but now i've found another problem.
My character faces the opponent, so when the x of the opponent is higher than the characters x I set mySprite.FlipX to false, and when it's lower, i set to true.
But the Advanced Collision Boxes doesn't follow this rule. They're all in the same place, even if the sprite is flipped.
Can you help me with that?

THANKS!

Edit 2:

Well, i've managed to make that. If anyone faces this problem, here's how to solve it:

Code: [Select]
float originX = (currentSprite.FlipX) ? -currentSprite.CurrentSprite.customColliders[i].origin.x : currentSprite.CurrentSprite.customColliders[i].origin.x;
Rect collisionRect = new Rect(
(gameObject.transform.localPosition.x+originX)-currentSprite.CurrentSprite.customColliders[i].Size.x/2,
(gameObject.transform.localPosition.y+currentSprite.CurrentSprite.customColliders[i].origin.y)-currentSprite.CurrentSprite.customColliders[i].Size.y/2,
currentSprite.CurrentSprite.customColliders[i].Size.x,
currentSprite.CurrentSprite.customColliders[i].Size.y);
Here is it working:


I made a DrawRect to see in inspector where were the lines, here's the code piece:

Code: [Select]
void DrawRect(Rect r, Color c){
Debug.DrawLine(new Vector3(r.x, r.y, 0), new Vector3(r.x +r.width,r.y,0),c);
Debug.DrawLine(new Vector3(r.x+r.width, r.y,0), new Vector3(r.x+r.width,r.y+r.height,0),c);
Debug.DrawLine(new Vector3(r.x+r.width, r.y + r.height, 0), new Vector3(r.x, r.y+r.height,0),c);
Debug.DrawLine(new Vector3(r.x, r.y+r.height, 0), new Vector3(r.x, r.y, 0),c);
}

See ya  :D

7
Support / Re: Detecting collision between 2 Advanced Collider
« on: May 23, 2015, 02:28:05 pm »
Hey unikron, thanks for the reply!

I found out that my character was too big, so I scaled it down to 0.6f in x,y and z.
This is how i'm drawing the rects in the screen:
Code: [Select]
for(int i = 0; i< currentSprite.CurrentSprite.customColliders.Length;i++){
DrawRect(new Rect(
gameObject.transform.position.x-(((currentSprite.CurrentSprite.customColliders[i].Size.x)*gameObject.transform.localScale.x)*gameObject.transform.localScale.x),
gameObject.transform.position.y,
(currentSprite.CurrentSprite.customColliders[i].Size.x)*gameObject.transform.localScale.x,
(currentSprite.CurrentSprite.customColliders[i].Size.y)*gameObject.transform.localScale.y),
       Color.blue);
}

I tried many variations and this only works for the HitBox, the HurtBox stays in the character feet.
Can you help me with the math? I mean, if i get the rect right, i can use it to check the collision

Thanks,
Murillo

Edit:

I decided to make a test and I scaled up my character to 1.0f in x,y and z

and this is what i'm trying to do:
Code: [Select]
for(int i = 0; i< currentSprite.CurrentSprite.customColliders.Length;i++){
DrawRect(new Rect(
gameObject.transform.position.x+currentSprite.CurrentSprite.customColliders[i].origin.x,
gameObject.transform.position.y+currentSprite.CurrentSprite.customColliders[i].origin.y,
                currentSprite.CurrentSprite.customColliders[i].Size.x,
currentSprite.CurrentSprite.customColliders[i].Size.y),
Color.blue);
}
And the box isn't aligned with the character:


I guess i'm not getting this math right  :-\

8
Support / Re: Detecting collision between 2 Advanced Collider
« on: May 23, 2015, 03:39:17 am »
Well, i've being trying to figure it out by my self, but i didn't went so far. I tried to make a collision based in overlaping, but i didn't manage to get the "advanced collision box" position right.

This is an example of what i'm getting:


Sorry for double posting.

Please someone help me :(
Thanks!

9
Support / Detecting collision between 2 Advanced Collider
« on: May 22, 2015, 02:32:42 am »
Hello there,

I'm making a fighting game and i need multiple boxes colliders in a single sprite, and the Advanced Collider functionality is perfect for it. But i don't know how to check if my hurtbox "overlaps" the hitbox.

I already tried to use this:
Code: [Select]
mySprite.CurrentSprite.customColliders[0]
But i don't know how to compare their both.

Can someone help me with that?

10
Well, i had this problem while working with iOS development.

Devices have a limited texture size, iphone 3~4 has a limit of 2048x2048, while ipad has a limit of 4096x4096... so, if you're making atlas higher than the limit, even tho the sprite has less than that, it wont work and will substitute for a black piece of sprite...

Check every sansung device for the GL_MAX_TEXTURE_SIZE and you can create atlases based on the screen size and manually change them in the begin of the game.

This might be the awnser you're looking for, but i bet the moderator will awnser you shortly!

Edit:

Using this website you can find different texture sizes for each device:
http://gfxbench.com/
Navigate to GL config > scroll down till you find: GL_MAX_TEXTURE_SIZE
like galaxy nexus:
http://gfxbench.com/device.jsp?benchmark=gfx27&D=Google+Galaxy+Nexus&testgroup=gl

11
Support / Re: Low fps on iPhone4
« on: June 25, 2013, 06:10:32 pm »
Omg, that's awesome!!

I'll try this when i get home tonight.

Thanks for the great support!

12
Support / Re: Low fps on iPhone4
« on: June 25, 2013, 03:50:16 pm »
Hello again, and thanks for asking me.

While reading your text, i might figured out what was wrong with my project... and i could reach 35fps by changing the shader and stuff, but here's the real problem:
I have a paralax background that is a mix of 8 images of the size 1500x 768, they all have alpha in them... (my project has 3000 total width, i cut the image in half to run in iPhone4, so i put these 1500 x 768 images one beside of another)

how can i avoid having those giant images??

i tried static batching but i the frame rate still the same, i think when i move them with my paralax script the static batch is ignored :/

Thank you very much again!
Murillo.

13
Support / Low fps on iPhone4
« on: June 25, 2013, 03:46:27 am »
Hello guys, Im doing this app aiming ios devices and i achieved a good result at iPad, but when i put the same app in iPhone4, it gets lagged and low fps(10 fps). I read a bit about what was doing that and now i think its aboult the shader... my project has 6 animated objects and more than 15 textures, some of them i tween. 99% of them have alpha and i think iphone4 is having some trouble to render it...

My question is: whats the best/fast shader to use for iOS iPhone4 for these objects with alpha??

Thank you very much,
Murillo.


PS: i got this shader from internet but it keeps spamming "Shader wants normals, but the mesh  doesn't have them" on console.


Shader "Scripts/NewAlphaShader" {
    Properties {
        _Color ("Color Tint", Color) = (1,1,1,1)
        _MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "white"
    }
   
    Category {
       Lighting On
       ZWrite Off
       Cull Back
       Blend SrcAlpha OneMinusSrcAlpha
       Tags {Queue=Transparent}
       SubShader {
            Material {
               Emission [_Color]
            }
            Pass {
               SetTexture [_MainTex] {
                      Combine Texture * Primary, Texture * Primary
                }
            }
        }
    }
}

14
Support / Re: Big Animation problem
« on: June 12, 2013, 04:03:58 pm »
Thank you very much, and sorry for bothering you!!

See ya,
Murillo

15
Support / Re: Big Animation problem
« on: June 12, 2013, 12:41:58 am »
The project target is ios and android devices. So, my texture must be 2048 or less.
I have an animation of 120 frames of a texture of 200x200. I haven't made any atlas, because i was thinking aboult this problem.

Thanks again.

Pages: [1] 2