Skip to first unread message

Amanda Valenti

Oct 25, 2022, 12:59:57 PM10/25/22
several students are getting this error and I can't find any mistakes.  They have defined everything, no mispellings. 

TYPEERROR:  Cannot read properties of undefined (reading "*")

CODE:  object1.pos.x=object1.velocity.x * deltat + object1.pos.x

I have tried and checke everything and it seems to not like the *.  Looking for help! Thank you. 

Joe Heafner

Oct 25, 2022, 1:39:08 PM10/25/22
to Web VPython Users

I don't see any obvious errors, and that line works in an example I just coded up and tried. Can you please provide a link to the entire program or copy and paste into a reply?

Joe Heafner
Sent from one of my Macs

Harlan Gilbert

Oct 25, 2022, 2:12:29 PM10/25/22
Are you sure that object1.velocity is defined as a vector?


You received this message because you are subscribed to the Google Groups "Glowscript Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Harlan Gilbert, Ph.D.
High School Chair and Math, Physics, Computer Science, and Philosophy Teacher
Green Meadow Waldorf High School
Chestnut Ridge, NY 10977

Joe Heafner

Oct 25, 2022, 3:06:13 PM10/25/22
to Web VPython Users

> On Oct 25, 2022, at 14:12, Harlan Gilbert <> wrote:
> Are you sure that object1.velocity is defined as a vector?

It was in my example on my end, but when it's defined as a scalar, as in the example below, I do indeed get the same error message. I think that's the problem.

Web VPython 3.2

object1 = sphere(pos=vector(1,2,3),velocity=5)
deltat = 0.01

object1.pos.x = object1.velocity.x * deltat + object1.pos.x


Bruce Sherwood

Oct 25, 2022, 3:20:06 PM10/25/22
to Glowscript Users
Good detective work! I'm surprised to see a statement updating only the x component of a moving object rather than using vectors: object.pos = object.velocity * deltat + object.pos

Reply all
Reply to author
0 new messages