Register
raylib»Forums»Change bounds.position and size
2 posts
Change bounds.position and size
7 months, 1 week ago Edited by ClemClem on April 19, 2020, 4:18 p.m. Reason: Initial post
Hello,

See this example : Raylib Examble

I change the position of the model => Vector3 position = { 0.0f, 0.0f, 0.0f }; to Vector3 position = { 0.0f, 50.0f, 0.0f };
I change the size of the model => DrawModel(model, position, 1.0f, WHITE); to DrawModel(model, position, 0.3f, WHITE);

Bounds are calculated from the original size of the model.
How can I change the position and the size of bounds to adapt the new position and the new size of the model ?

Thanks :)

Clem
3 posts
Change bounds.position and size
7 months ago
There's actually a hint in the code! It says that the bounds are calculated from the original size of the model,
if model is scaled on drawing, bounds must be also scaled.

That's just a matter of scaling the bounds like this:

1
2
3
float Scale = 0.3f;
bounds.min = Vector3Scale(bounds.min, Scale);
bounds.max = Vector3Scale(bounds.max, Scale);

2 posts
Change bounds.position and size
7 months ago
Hello,

thank you for this answer Tjom2000 :)
Ray
61 posts / 1 project

I love videogames development.

Change bounds.position and size
7 months ago
Yeap, that's the answer, bounds should be manually recalculated by the user.