Why doesn't Vcam work?

Fill this out this info to make it easier for the community to help you! If you don’t fill out this information, your post may be deleted or removed.

What Wick Editor Version are you using?
1.19.3

Describe the Problem
The Vcam doesn’t really work.

What have you tried so far?
I have experimented a lot with the Vcam. But it just ends up zooming me in or changing my canvas size.

the vcam is a weird bit of code for me and I usually add things in and not change things.

Is there a way to get Vcam working properly?

When you say “Doesn’t really work,” what exactly do you mean? What does it do?

I guess it just sometimes shrinks my canvas size, brings my zoom level just like the Vcam, all that stuff.

my interpretation is that when you export to html, the vcam doesn’t get the correct size of the window and usually shows up too big or too small.

unfortunately something happened with it, or something… i think when the vcam first was “released” it worked perfectly, but now it doesn’t… i’m sure there’s a way to fix this by editing the code of the vcam.

edit: ok what i suspect is happening is that in html exports, the html knows how to zoom itself. if you just export a random html file, run it, and resize the window, it will resize perfectly. however, when you use a vcam, the effects of the vcam and the html resizing are done on top of each other (the vcam doesn’t override the html resizing, they do it at the same time), and it appears smaller than needed when the window is small. this doesn’t occur inside of wick or an iframe because there, the html doesn’t try to auto-resize, so only the vcam is doing the resizing.

see the results for yourself

i made a project trying to recreate the vcam based on the existing vcam (it only does zooming in/out, no panning or rotating, and the code is in a frame, not a clip).

if you run the wick project in the editor, it works well.
My Project11-26-2021_13-22-13.wick (1.7 KB)

if you run the html project, it zooms too much/little.
My Project11-26-2021_13-22-19.html (2.1 MB)

here’s 2 replit links, one to the editor and one to the actual project. if you have an account, you can try the first link, which is the code editor thing. you’ll see the result for if the project is in an iframe (or whatever it is), which works well. the result is identical to if you opened the project in the editor (the part of the editor with the canvas is basically an iframe).
https://replit.com/join/wduvesmfvj-baronawc95014

or you can use this link to see the result for if the project is in a tab, which is problematic. this is identical to the html export.
https://wickvcamtest.baronawc95014.repl.co/

@Jovanny i made this repl intending to try find out where in the code the html does its resizing, but i figured it would take too much time. do you know where the html auto-zooms, if my theory is correct?

also let me know if i uploaded the wrong files.

1 Like

actually, you are ahead of me on this one… i havent actually used the vcam (the built in one). you may be right.

Thank you for your help! But is there a way to code the Vcam (the built in one) to work? If so, could you give me the code?

The [repl] console shows this error at line 51,597
image
Which might be connected with the zooming issue (I’m not completely sure though).


I don’t know how to re-code the vcam to work, but if you don’t need the vcam for zooming, you can disable it from zooming by removing lines 17-23 in its update script.

image

This way, the project will be zoomed correctly (no matter the window size) and the vcam will only be helpful with panning and rotating the screen.

just read the post i made yesterday of me fixing (or trying to fix) the vcam. it has a temporary solution.

1 Like

Is there a way for you to send me the project file where the Vcam works? For example, could you make your own Vcam and then give me the file so I can maybe copy and paste it into my own project? Thanks!

if you just read the post i gave you, you will find what you need.

Okay. It seems like we don’t know how to reprogram to Vcam asset but we can make the frame zoom in! Thanks for your help! Although I do wish Vcam could be working properly tho

Is there a way to get Vcam working properly.

I dont think so but I found someone who made a different vcam it works pretty nicely
Here the file
vcam wickobj (google drive)

Why don’t we all try do the impossible?

Hmmm. The design is great but it still doesn’t work and it is very common (like very common) that the Vcam is just too fast.

We don’t know right now.

@awc95014 I have an idea! If Wick Editor is just like flash but easier to manage, why don’t we try to code used to make a Vcam FROM flash?

There’s two type of code tho

Option 1:
import flash.geom.Matrix;
import flash.geom.Transform;
import flash.geom.ColorTransform;
var cameraTrans:Transform = new Transform(this);
var stageTrans:Transform = new Transform(this._parent);
var w:Number = Stage.width;
var h:Number = Stage.height;
this._visible = false;
this.onEnterFrame = function () {
this._parent.filters = this.filters;
stageTrans.colorTransform = cameraTrans.colorTransform;
var stageMatrix:Matrix = cameraTrans.matrix;
stageMatrix.invert();
stageMatrix.translate(w*.5, h*.5);
stageTrans.matrix = stageMatrix;
};

Option 2:
var cameraTrans:Transform = new Transform(this);
var stageTrans:Transform = new Transform(parent);
visible = false;

stage.addEventListener(Event.ENTER_FRAME, updateStage);
function updateStage(…rest) {
parent.filters = filters;
stageTrans.colorTransform = cameraTrans.colorTransform;
var stageMatrix:Matrix = cameraTrans.matrix;
stageMatrix.invert();
stageMatrix.translate(stage.stageWidth*.5, stage.stageHeight*.5);
stageTrans.matrix = stageMatrix;
};
updateStage();

addEventListener(Event.REMOVED_FROM_STAGE, resetStage);
function resetStage(…rest) {
stage.removeEventListener(Event.ENTER_FRAME, updateStage);
stageTrans.matrix = new Matrix();
stageTrans.colorTransform = new ColorTransform();
parent.filters = new Array();
}

I haven’t tested this out yet, so this might not work.

couple issues with this.

first, flash uses actionscript or something, not javascript. there’s a very low chance those libraries exist for javascript.

second, the problem isn’t that the vcam’s code is bad, the problem is that when you export a wick project in HTML, the HTML project itself does resizing on its own (so that the project fills the screen). if you don’t have a vcam, the HTML project will resize itself when you resize the window. once you add a vcam, the effects stack on each other and the zoom is incorrect. what I’ve done is I basically added a line of code to cancel out the HTML project’s zooming before setting the actual zoom. so making a new vcam here is pointless.

third… it works well already.

also @Jovanny would it help to fuse this topic with my topic or something, is there a way to do that?

1 Like