Jump to content
  • Advertisement
Sign in to follow this  

vector multiply webgl

This topic is 2480 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How i can multiply two vector3 or two vector4 in webgl?
I tryed vector1 * vector2 but is don't correct.

Share this post

Link to post
Share on other sites
because i have this code for zoom on orbital camera ,but when this.m_orbitOffsetDistance become negative , i can't zoom

zoom: function (zoom, minZoom, maxZoom) {
if (this.m_behavior == CAMERA_BEHAVIOR_ORBIT) {
// Moves the camera closer to or further away from the orbit
// target. The zoom amounts are in world units.

this.m_orbitMaxZoom = maxZoom;
this.m_orbitMinZoom = minZoom;

var vOffset = vec3.create();
vec3.subtract(this.m_eye, this.m_target, vOffset);

this.m_orbitOffsetDistance = vec3.length(vOffset);
vec3.normalize(vOffset, vOffset);
this.m_orbitOffsetDistance += zoom;
// this.m_orbitOffsetDistance = Math.min(Math.max(this.m_orbitOffsetDistance, minZoom), maxZoom);

vec3.scale(this.m_orbitOffsetDistance, vOffset, vOffset);

vec3.add(vOffset, this.m_target, this.m_eye);


Share this post

Link to post
Share on other sites
What exactly are WebGL vectors? you are using code someone made, so just open it and find the correct function... (it's probably named "x")

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!