Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document function BotAimAtLocation #2879

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sweet235
Copy link
Contributor

This is just comments. Document the slightly unexpected behavior of the function BotAimAtLocation.

I would propose a concrete solution, but I am still learning how to handle the angles pitch, yaw, roll.

@sweet235
Copy link
Contributor Author

Well, I am not sure if I understand what is going here. This function seems to work with absolute coordinates iff the bot is perfectly horizontal. I will try to understand this before I make an attempt to merge this.

@sweet235
Copy link
Contributor Author

Turns out someone™ exploited this behavior in BotClimbToGoal in sg_bot_nav.cpp:

static void BotClimbToGoal( gentity_t *self )
{
	glm::vec3 ownPos = VEC2GLM( self->s.origin );
	glm::vec3 dir = self->botMind->nav().glm_dir();
	BotAimAtLocation( self, ownPos + 100.f * dir );     // this makes the bot look straight ahead on walls/ceilings, not sure why
	self->botMind->cmdBuffer.upmove = -127;
	self->botMind->cmdBuffer.forwardmove = 127;
	self->botMind->cmdBuffer.rightmove = 0;
}

I remember wondering why this works on walls and ceilings. Maybe the current behavior is, in a way, reasonable.

@slipher
Copy link
Contributor

slipher commented Jan 12, 2024

I don't get what is the unexpected part.

	glm::vec3 ownPos = VEC2GLM( self->s.origin );
	glm::vec3 dir = self->botMind->nav().glm_dir();
	BotAimAtLocation( self, ownPos + 100.f * dir );

Wouldn't this always be expected to make the bot look straight ahead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants