Pivot Problem
Blitz3D Forums/Blitz3D Beginners Area/Pivot Problem
| ||
When the player (guy) is at certain distance from both pivots on the map, the camera is snapped into a particular place. I must be doing the first line of code wrong, because it's not working:If EntityDistance(guy,pivot1) < 19 And EntityDistance(guy,pivot2) > 20 Then PositionEntity cam,-5.349,6.429,50.7331 RotateEntity cam,0,-71.2019,0 TurnEntity cam,32.6007,0,0 EndIf |
| ||
It may not be evaluating exactly how it looks like it should. Try If (EntityDistance(guy,pivot1) < 19) And (EntityDistance(guy,pivot2) > 20) Then or if (EntityDistance(guy,pivot1) < 19) then if EntityDistance(guy,pivot2) > 20) Then ;do stuff endif endif Putting debugs in that might help you work out what's happening. |
| ||
Nope, doesn't work. And before I tried putting a variable which would add if it works. The variable remained 0. |
| ||
Hmm, bit hard to solve this without any further code. The second condition is correct ? > 20 ? Debug this using: Text 0, 0, EntityDistance(guy, pivot1) Text 0, 20, EntityDistance(guy, pivot2) |
| ||
If EntityDistance(guy,pivot1) < 19 And EntityDistance(guy,pivot2) > 20 Then Shouldn't that be: (two greater than symbols ">") or two less than symbols "<" ? If EntityDistance(guy,pivot1) > 19 And EntityDistance(guy,pivot2) > 20 Then or If EntityDistance(guy,pivot1) < 19 And EntityDistance(guy,pivot2) < 20 Then |
| ||
No Ross. It's complicated (what I'm doing) so I can't really describe. All I know is that my code looks exactly like I want it to look, only it doesn't work... And bram32, I already have that. And both pivots are correct. |
| ||
Have you used the Text-test at this particulair point in the program (right before the IF)? Have you tried the first tip of Hockings ? Because Blitz uses only bitwise AND instead of a logical one. That could mean you should use the brackets. Even if it doesn't solve your problem it is probably best, just in case. Have you tried testing them one by one ? Try calling "END" to see if the program quits. If EntityDistance(guy,pivot1) < 19 then END ;If EntityDistance(guy,pivot2) > 20 then ENDIs this code in a Function ? Are cam/pivot1/pivot2/guy defined globally ? |
| ||
Better yet, anyone got a better idea for a "trigger" system? I want the camera to move to a specified place once the player activates a trigger or walks near a certain point. |
| ||
WOW! I feel like the biggest idiot in the world. That little bit of code was in between a function that required a keyhit. I'm really sorry for wasting you time :( |
| ||
Well, good to hear you solved it. : ) |
| ||
Yeah :) But still, anyone got a better idea for a "trigger" system? |