
Advertisement
MikeKan13
Member
Content Count
28 
Joined

Last visited
Community Reputation
102 NeutralAbout MikeKan13

Rank
Member

Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
Can't get it for the reverse. I just switched the variables around so that b would be d. I also tried switching all the y subtraction math around cause I thought maybe it was giving negative values. 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
YES! You sir or ma'am are a genius and I love you to the power of 100. Works perfectly! 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
I just got home from working a 12 hour day and I am really tired. I skimmed it and it makes more sense to me now. I will try and implement it after work tomorrow. Thank you. 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
confused... p = redVector + blueVector [color=#282828][font=helvetica, arial, verdana, tahoma, sansserif]p = c1*e1 + c2*e2[/font] [color=#282828][font=helvetica, arial, verdana, tahoma, sansserif]p.x = c1*e1.x + c2*e2.x[/font] [color=#282828][font=helvetica, arial, verdana, tahoma, sansserif]p.y = c1*e1.y + c2*e2.y[/font] [font=helvetica, arial, verdana, tahoma, sansserif][color=#282828]c1 is used in these equations and then [/font] You find the value of c1 using the previous values you just found using c1?!?! [color=#282828][font=helvetica, arial, verdana, tahoma, sansserif]c1 = (p.x*e2.y  p.y*e2.x)/(e1.x*e2.y  e1.y*e2.x)[/font] Also I am not a very strong math person. What does normalize mean? Edit: I am trying to go through and understand. are e1 and e2 cordinates, lines, distances? you have e2.y and ect so it makes me think they are coordinates. Sorry I am very bad with math. I looked up normalizing numbers and it is simple enough. what I don't understand is am I getting a set of coordinates for the line or is it a set of lengths. Also is p.x and p stuff the players x or do you mean the line p in the picture. Please clarify and dumb it down for me. Things like this : [color=#282828][font=helvetica, arial, verdana, tahoma, sansserif]p = redVector + blueVector < how do you add two lines together? They consist of 4 sets of different cords.[/font] 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
It is possible I guess but a = point_distance character x,y to right top edge (of slope sprite) b= point_distance character x,y to right bottom edge c = point_distance right top corner to right bottom corner s = (a+b+c)/2 ar = sqrt(s*(sa)*(s b )*(sc)) distance = ar / (c * .5) the descriptions he gives for the points are vague. I am not sure if by right top edge he means the ztop of the ramp or the y of the sprite or the y of the diamond or what. I have tried many different combinations and no luck. It is giving me like a corner of a pyramid. I am searching on the internet but can't seem to find anything else. 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
NM his simple one does the relatively same thing as the complex one and neither work. This is ridiculously difficult. 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
http://gmc.yoyogames...howtopic=386179 it is on the second page. He also mentions another very simple one of just turning the coordinates to their isometric coordinates. I tried this one and it worked very well except sometimes I would fall through my floor near the bottom of ramps. I might be able to rework my own code to use this one. I think if I could get the trig equation to work it would be the best though I do not understand it completely and I might be using incorrect values. Like I said It works for the left side of the ramp but at the bottom of the right side the player pops up instead of smoothly gliding onto it like the right side. Then at the top of the ramp on the right side he is higher than he should be. i tried using your code and It made the player jump in random places on the ramp. I might take another look at it though. Edit: Help to find that post: It is halfway down on the second page posted by althing06[color=#EEEEEE] 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
I couldn't get yours to work but I did find someone who had a trig alogorithm. I won't pretend to understand it but I plugged in my values and it sort of works. I might have done it wrong but it works if the player is near the left side of the diamond but then messes up towards the right.(left and right if block was viewed with your head tilted to the right.) here is the code a = GetDistance(Player.localX, 0, Player.localY, 22, 0, BLOCK_Z) b = GetDistance(Player.localX, 0, Player.localY, 22, 0, 0) c = BLOCK_Z s = (a + b + c) / 2 ar = (s * (s  a) * (s  b) * (s  c)) ^ 0.5 distance = ar / (c * 0.5) Player.z = distance ...... Public Function GetDistance(ByVal x1 As Long, ByVal x2 As Long, _ ByVal y1 As Long, ByVal y2 As Long, ByVal z1 As Long, ByVal z2 As Long) As Long GetDistance = ((x2  x1) ^ 2 + (y2  y1) ^ 2 + (z2  z1) ^ 2) ^ 0.5 End Function 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
sorry I don't understand can you give me an example equation. 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
There has to be an equation to find the z. I can find the length of the ramp and any length of any lines in the block. Do i need to get the angle of the ramp and do something with that? 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
The game is 2d and the entire engine is written that way. 
Should be easy find Z on a ramp with x and y (SOLVED)
MikeKan13 replied to MikeKan13's topic in Math and Physics
Hrmm not sure exactly what you are saying. I shouldn't need a minx miny or minz. I guess my drawing is kind of confusing. Let me try to explain better. All of this is within one block. Think completely local coordinates. So the far top left (outside the isometric square) would be 0,0. For the sake of simplicity lets say the max x for the block is 88 the max y is 44 and the max z is 60. again for simplicity lets say the player is at 88,22(the right tip of the diamond) how do I find his z. obviously his z would be 60 but I need an algorithm that considers any possible point in the diamond. 
I need to find the players z if he was standing on an isometric ramp. I know the isometric tiles width and height (if it was square) and using Pythagorean I can get the ramps length. I just cant figure out what his given z would be.

Advertisement