Lookat problems with nodes

You dont need to be rude by the way.

What direction should an object sitting at 0,0,0 rotate to look at an object at 0,0,0? There is no answer because an object at 0,0,0 CANNOT look at an object at 0,0,0. This creates an invalid transformation. Basically your eyes roll back into your head and you can’t see anything anymore. (Trying to put it into terms you will understand.)

It creates an invalid transformation. Invalid means it won’t work. As in, you won’t see anything. Like, won’t see anything at all because the transform is invalid. And by “won’t see anything” I don’t mean “looking in some strange direction”. I mean YOU WON’T SEE ANYTHING. 0 objects. Well, you are seeing them but they are all of 0 size in an infinite distance in an imaginary direction.

1 Like

Yeah, I’m just going to stop replying to your posts. Sorry.

I get very frustrated when I reply “well your code is wrong because of this” and get a response “Yes, I know my code is wrong because of that. What’s the issue?”

I have very little time these days and so have zero patience for this kind of time wasting. I will no longer reply to these posts in the future. Others will have more patience and can help you.

Sorry again.

I understand what you are saying, but I have an intire code working doing exactly this, and as I said its working, the node1 when look at node2 at the same position just rotate into it.
I was doing this to make an slerp camera, if this is the wrong way to do it, nice, thank you, you just solve the issue.

You guys are beeing very rude, I guess people stops to come into this site because of this. That is bad for the engine, I dont get why you came here and try to help people if you do this at all…
I have a valid post here, I got an impression that the lookat works in a way you are saying its not that way, its an valid post, will help peaple to understand how this works.
I saw lookats in another engines and they rotate objects in the same position, so I thought it works that way here, please be more polide.

Please explain how an object at world position 0,0,0 can rotate to look at an object at 0,0,0.

How can your eyes look at your own eyes?

In other engines, the lookat checks the position, if its in the same position it just rotate into it.
Think asking a object head and eyes to look into a direction the other head is looking at.
And as I said, if you try to do some tests, if you rotate they a bit they will work, but if you are saying this is invalid in this engine, I believe you, no more discussions, after all, you are core developer…

I saw the problem in your code and I pointed it out only to have you tell me that you already know that’s a problem. This is the same as wasting everyone’s time. Some people are more ok with that than I am. Given how this same thing has happened in your other threads, I should have known better. The mistake is mine as I should have let more patient people answer.

If you want one object to look in the same direction as another object then set the rotation the same.

What I don’t understand is why you are even trying to do that. Aren’t you actually trying to have the camera look at the planet? These two things will never be at the same location.

You might also benefit from this article:
http://mywiki.wooledge.org/XyProblem

1 Like

Well, I really do need to use lookat because it will not look at the planet but to the cube in slerp, and it will not be at the same position after the player moves it.
It was much more easy to do it using lookat on the nodes, but I didnt notice that it could not be valid in jmonkey, thank you for clarifying it.

And I am really sorry for any problem or frustration you had with me in another thread, I really make a mistake in there and I am trying to make the communication works from now on.

Just to add, I really didnt even consider it to be invalid, as I am use to do this in other engines, so this is really valid for others in the same condition. Thanks again.

Well, it’s possible the code could be more graceful or throw an error if you ask for the impossible… but the fact that other engines do something arbitrary in this case is not necessarily comforting either. I would think the best option would be to do nothing at all else you end up with very strange visuals potentially.

JME tends to opt on the side of performance in these cases and so trusts the user to pass in sensible parameters. Else it has to check every time for whether they are sensible or not which slightly slows down the 99.9% of cases where good values were passed in to catch the one crazy time. Generally not a good trade.

You could always do this check yourself.
float length = obj1.getWorldTranslation().distanceSquared(obj2.getWorldTranslation));
if( length < minDistance ) {
// Do arbitrary direction setting (my vote would be for ‘don’t change the direction at all’)
} else {
// do the lookAt
}

Thanks @pspeed . I will rewrite my code just to use the lookat at the right way ( not using same positions ). There is more weird stuff that happens when I do lookat on objects in the same positions ( more blind places others than 0,0,0 guess 180º ), so I guess its bether just not to use it ever that way.

180 degrees should not be a problem for look at. But since I don’t know what the “problem” was, I can’t really comment on what else it might be.

There is some spot where it inverts the upvector even if you force it to be the upvector of the camera. I am not sure witch angle is, I guess its 180º, but not sure.

If you look at the same direction as the up vector then you will have strange issues. Other than that, all angles should work assuming you have enough distance for the calculations to work. (distance > some small epsilon)

You said a nice truly statement:

Others engine are made for users with low programming skills (like Unity3D which a non-programmer can develop games). This is a good thing…for those who don’t know how to write a good code.

What makes JME3 the best choice to me in Game Development is this performance goal and the source code available.If I have any doubt about a

If I can give my cents about the “communication issue” on this thread, I saw many questions that askers does not perform a simple search (I’m not saying that’s the case here) on Google, Wiki or Hub before asking for help and when they do, they simple do the question without context or source code…As @pspeed said other day:

And we got some times the old and “good” XYProblem

Yep, that is why I am using Jm3 as well, besides the performance, you have more freedom to do stuff. About communications, there is not only simple search that fix all problems, in the case with pspeed, I wrote a post with some swapped wrong words and it makes it impossible to understand , it is something to be more careful as well.
Also sometimes its hard to explain what you mean in the thread, and to understand it as well when you are in the other side, when I tried to help some peaple I figure out that sometimes there is missing informations, its frustrating, I understand pspeed on that.

1 Like