It was his first tour abroad and his job was to train Afghan soldiers, so "we weren't expecting any danger," said his grandmother Patricia Segovia.
But on Aug. 10, Rivera was shot to death as he worked out in a camp gymnasium — where Marines are prohibited from bringing weapons — by a 15-year-old Afghan soldier he'd been training. Two other Marines also were killed in the shooting.
So-called green-on-blue attacks — by Afghan soldiers on their U.S. trainers — have become increasingly common in Afghanistan. His death, his grandmother said, "was not an act of war. It was a murder."
Rivera, who turned 20 in July, died the day before his Afghanistan tour was scheduled to end, Segovia said. He was to be sent back to Hawaii, where he was stationed. His family was making plans for a September homecoming.
Richard Anthony Rivera Jr. was born and raised in Oxnard. At Rio Mesa High School, though tall and thin, he was a wrestler and a linebacker on the Spartan football team.
He was a gregarious, talkative kid — "a firecracker," said his cousin Richard Gallarza. "He was spontaneous, the life of the party."
Rivera had dreamed of becoming a Marine since early in high school, Gallarza said. A month after graduating, and a couple of weeks before his 18th birthday, Rivera joined the Corps and was eventually stationed in Hawaii.
He was one of a group of six Rio Mesa football players who spoke often of joining the Marines, said Gallarza, who is part of the group and just returned from his own tour in Afghanistan.
All are now Marines, stationed in various parts of the world. Once in the Corps, they all got tattoos that read "Our Bond Is Forever Tied by Blood Till the Day We Die We Are One." Rivera had his tattooed on a bicep.
Rivera kept in touch with his coaches after leaving school, dropping by when he was home to tell them what life was like at Pearl Harbor, said Bob Gregorchuk, the team's head coach.
"He was one of those guys people were drawn to. He'd come up, shake your hand, look you in the eyes, greet you. When he went to the Marines, it was no surprise that he excelled," Gregorchuk said. "I was proud that I got to coach him and say this young man represented our football program."
More than 2,000 people attended the funeral service Tuesday for Rivera at Santa Clara Catholic Church in Oxnard, including some of his elementary school teachers and his high school football coaches. His remains were cremated and will be kept at home with his mother.
The Rio Mesa Spartans are dedicating their first home game, Friday, to him.
Rivera is survived by his parents, Linda and Richard, and younger brother, Isaiah, as well as aunts, uncles and numerous cousins.
For Gallarza, also a former Spartan linebacker, his cousin's death has led to some reexamination of his decision to join the Marines.
"I'm glad that I did it. It kind of makes you grow up real quick. That's what I needed after high school," said Gallarza, now stationed at the base at Twentynine Palms. But "I do know for sure I'm not going to be a 20-year man. After all this stuff, I'm pretty sure I just want to get out and move on with my life."
Segovia is left remembering the grinning grandson for whom she always made tamales, and the enormous crowd that turned out for his funeral.
"I feel blessed that my grandson is being honored," she said, "and that his service to this country is recognized — that he counted to a lot of people besides his family."